Results 1 to 3 of 3

Thread: conversion problem 2002->2000, empty textfields

  1. #1
    Join Date
    Oct 2003
    Posts
    5

    conversion problem 2002->2000, empty textfields

    Ok I´ve converted a mdb-file from 2002-to 2000-format and the following problem keeps occurring with a sub-procedure that is supposed to hand over a report to Word.

    Private Sub report2word(reportname As String)

    Dim filepath As String
    Dim wordpath As String
    Dim command As String

    filepath = "C:\temp\report_test.rtf"

    DoCmd.OutputTo acOutputReport, reportname, acFormatRTF, filepath

    wordpath = "C:\Programs\Microsoft Office\Office10\winword.exe "

    command = wordpath & Chr(34) & filepath & Chr(34)
    Call Shell(command, vbMaximizedFocus)

    DoCmd.Close acReport, reportname

    End Sub
    The problem is that the file in 2000-format run in Access 2000 fails to save the rtf-file according to the path given. The directory in question is not write-protected and only the saving seems to be a problem, everything else works. (btw it works beautifully in Access 2002). What might be wrong?

    Ok, I have a second problem, please bear with me for one more second. In order to make the entry of addresses more user-friendly I am trying to pull out the name of the location and the county according to the postcode just entered (afterupdate) from a table (tbl_postcodes) and fill them into their respective fields on the form *but only in case these fields are empty* (to make sure a previous entry is not automatically overwritten).

    This is what I came up with:

    Private Sub postcode_AfterUpdate()
    'tbl_postcodes contains a full directory of all the postcodes and locations in my country (Germany)

    If trim(Me!location) = "" Then
    Me!location = DLookup("location", "tbl_postcodes", "postcode=" & Me!postcode)
    End If

    If trim(Me!county) = "" Then
    Me!county = DLookup("county", "tbl_postcodes", "postcode=" & Me!postcode)
    End If
    End Sub
    the above procedure works like a dream without the if-clauses, but fails to work with them. I have tried it with IsNull(), IsEmpty() and without the trim()-function, but it doesn´t work. When trying to debug, I only learn that the fields location and county are not empty, do not equal null etc. but they do not contain any visible characters on the form. I am completely clueless here, does anyone have a hint?

    Thank you in advance for helpful suggestions!

  2. #2
    Join Date
    Oct 2003
    Posts
    8
    A question for your second problem. Are the country, postal code, and location all in one table?? Or is the postal code in another table??

  3. #3
    Join Date
    Oct 2003
    Posts
    5
    twinman326: yes they are all in one table - it´s basically a list of all postcodes and appropriate locations. as I mentioned in the post the retrieval of the names of the locations and counties works *lovely* without the if-clauses - once put in an if clause the command with the DLookup()-function is never executed because for some reason (only the highest Gurus might know) Access thinks that the fields on the form are *not* empty even though they are as virgin and untouched as it gets. again, the reason I am putting the assignment into an if-clause is that I want to prevent previously entered values to be changed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •