Help with DLookup - not working (1 Viewer)

jdp103

Registered User.
Local time
Today, 17:55
Joined
Sep 26, 2003
Messages
46
I have a "status update" subform on a form that the user can go in and put periodic updates for that record. I have one field on the subform called UpdateStatus that I want it to get its value from the current value on the main form (which changes periodically) called SDPPhase so that you can see the status at the time of the update and have a history.

I am trying to do this using DLookup with the following code in the UpdateStatus field:
=DLookUp("SDPPhase","BRD","BRD_Id = " & [BRD Id])

BRD is the main form's table and BRD_Id is on both forms and what links the subform.

The problem I am having is that although when I step through it...it picks up the correct BRD Id, the output is ALWAYS the value for the very first record in the BRD table...not the one for the BRD_Id on the current form.

I also tried putting the code in the form properties for the subform but that doesn't work either.
Any help would be GREATLY appreciated!!
 

MarkK

bit cruncher
Local time
Today, 14:55
Joined
Mar 17, 2004
Messages
8,186
You refer to the same value as [BRD id] in one place and BRD_Id in another, but these are different names.
A suggestion I have is to never name anything that requires the use of square brackets. No special characters and no spaces in field or control names, and it's my suspicion that this is at the root of your problem.
=DLookUp("SDPPhase","BRD","BRD_Id = " & [BRD Id])
I suspect that the name in bold is not referring to what you think it is. Also, look into the use of the 'Me' keyword.
 

Users who are viewing this thread

Top Bottom