DLookup Problem (1 Viewer)

gguy

Registered User.
Local time
Today, 03:50
Joined
Jun 27, 2002
Messages
104
I am using Dlookup on a form to find a weight value (like 1 gram) in a table called standard. The field in standard that contains the weights is call denom_actl. Every record in standard has a unique serial number (serial_no).

On the form I am using an unbound box called serial to enter the serial number. Then I have an unbound box called denom and in its control source I add the following dlookup;

=DLookup("[denom_actl]","[standard]","[serial_no]=[serial]")

This should produce the weight associated with the specified serial number, and it does but only after I go to design view and come back. How can I correct this?


Thanks in advance for any help. GGuy
 

Drevlin

Data Demon
Local time
Today, 03:50
Joined
Jul 16, 2002
Messages
135
Put a Me.Refresh call in your Serial_LostFocus() event.
 

gguy

Registered User.
Local time
Today, 03:50
Joined
Jun 27, 2002
Messages
104
That's it!

Thanks Drevlin
 

ghudson

Registered User.
Local time
Yesterday, 22:50
Joined
Jun 8, 2002
Messages
6,195
Note that the reference to the control isn't included in the quotation marks that denote the strings. This ensures that each time the DLookup function is called, Microsoft Access will obtain the current value from the control.

DLookup("[denom_actl]", "standard", "[serial_no]= " & Forms!YourFormNameHere!serial)

HTH
 
R

Rich

Guest
Why not use a combo box and save yourself trouble and the use of an inefficient Domain function?
 

gguy

Registered User.
Local time
Today, 03:50
Joined
Jun 27, 2002
Messages
104
I am a newbie and I must say, I do not know enough about how combo boxes work.

When this form is used a lab worker will have a weight in front of them. Therefore, they have the serial number that is typed on the weight and they will know the company that brought in the weight. The thing I did not tell you is the weights come in kits, so one serial number may have upto 100 weights in the kit. So I am using an AND to include the weight number in the criteria.

My users would rather look at the weight, type the serial number and weight number and hit the tab key. They have express that they do not want to pick from a list. When they have verified that the weight is in the table and associated with the right company, they will go on with the test.

Can a combo box accomplish this task more efficiently? GGuy
 

Users who are viewing this thread

Top Bottom