Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    lookup fields in report not printed (Access 2000)

    Lookup fields on a report are not printed out.


    I receive blanks for all the lookup fields on my report. On my invoice i have DLookup functions giving me the data from thje table

    MyCompanyInformation.This table is not related with the other tables. My Dlookup function on the report looks like this:
    ="city : " & "" & [city]
    ="Telephone : " & "" & [PhoneNumber]
    ="Vat Number : " & "" & [Vat]
    etc. etc
    I open the report with the following code
    Dim stLinkCriteria As String
    Dim stDocName As String
    stLinkCriteria = "orderid = " & OrderID
    stDocName = "Invoice"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    DoCmd.printout acPages, 1, 1, acLow, 1, True

    However all the lookup fields are not printed. The fields are visible when i open the report in a preview mode,
    also i can print the invoice if i use the command file-print from the menu.I need however use the above code and i simply cannot do it.
    I tried not to open the report in a preview mode,i to code it in a Normal view, but then i cannot attach the LinkCriteria.I hope somebody may help me along these lines, but i will be grateful for any solution indeed. It is a very important problem for me and i will be really grateful if i receive some help.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lookup fields in report not printed (Access 2000)

    i have to correct myself the lookjup fields look like this


    ="Telephone : " & "" & DLookUp("[PhoneNumber]";"My Company Information")

    i didnt write it correctly the firs ttime, but the problem remains as i have written it

  3. #3
    Star Lounger
    Join Date
    Nov 2001
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lookup fields in report not printed (Access 2000)

    Hmmm. You say that the Company information is not related to any other tables but you are opening your report specifying a particular record. My question is: how do you know which phone number to print if there is no relationship between the Customer information and the rest of the data? DLookup needs the Where argument if you want to show a specific telephone number for a specific Customer and order.

    Jack

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lookup fields in report not printed (Access 2000)

    Thank you .Yeas you are right,there is no relationship,i have only one row in this table, which is the information for MY Company and not the Customers company.So there is alweays on e telephone number to show.. Actuallyt this information should always be one and the same for each invoice. But the owners of the MyCompany might change.My question is how can i avoit the command Preview and how to print these lookup fields.
    regards

  5. #5
    Star Lounger
    Join Date
    Nov 2001
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lookup fields in report not printed (Access 2000)

    The Control Source for the the Unbound text boxes should look like this:

    =DLookUp("[PhoneNumber]","My Company Information")
    =DLookUp("[City]","My Company Information")
    =DLookUp("[VAT]","My Company Information")

    That should do it....

    Be sure that you have the correct names of the fields in your Company Table in the code above.

    hth,
    Jack

Posting Permissions

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