DLookUp Problems

Talismanic

Registered User.
Local time
Today, 05:16
Joined
May 25, 2000
Messages
377
I can not get DlookUps to work consistantly. I have been through Access help and can make them work with simple tables and forms. But now I have a form with a subform and all I get is errors. I have tried it in the control source and as a macro.

Here is the break down:
Table Name JobNumbersTbl
Feild1 in tbl. JobNumbers
Feild2 in tbl. JobNames
Form Name TimeSheet
Sub Form TimeEntry

Field name in TimeSheet for the info is [JobNumber]
Feild name with the DlookUp is [JobName]

Here is the DLookUp syntax I am using with a macro:

SetValue
Item [Forms]![TimeSheet]![JobName]
Expression DLookUp("JobName","JobNumbersTbl","[JobNumber]=" & [Forms]![TimeSheet]![JobNumber])

When I enter the expression I do not put brackets around the forms but Access keeps adding them, could that be related to the problem? I have never seen them in any of the examples of DLookUps.

As a control source I use the above expression with an = sign before it and get an error. Any ideas?

[This message has been edited by Talismanic (edited 05-25-2000).]
 
I think I have it figured out now, I changed the DLookUp to this and it seems to work fine for me:

DLookUp("[jobname]","jobnumbers","[jobnumber]=forms![TimeEntry]![jobnumber]")

I also modified some table and field names.

[This message has been edited by Talismanic (edited 05-25-2000).]
 

Users who are viewing this thread

Back
Top Bottom