dlookup

kitty77

Registered User.
Local time
Today, 17:45
Joined
May 27, 2019
Messages
719
I have a form based on a table called calc. On that form, I have a fields called idnumber and standard.
I would like to do the following... If the valve in idnumber (after update) equals or exists in table main (a different table)
then the valve on my form for standard is the valve from table main.

Basically, I would like to get the valve from another table if it's equal and paste that valve into my form.

I guessing some kind of dlookup? Hope I explained it well enough...
 
You could use DLookup() in some code. Have you tried this yet.

Alternatively, perhaps you could use a combo box to enter the idnumber. If the combo is populated by the data in the "other" table then you could populate the text box from a hidden column in the combo.
 
No, I have not tried the DLookup. Not sure how to start that.
 
Use the BeforeUpdate or AfterUpdate of the ValveID textbox to get the info:

Private sub valveID_afterupdate()
Dim strValveDesc as string
If len(me!valveID & "") > 0 then
StrValveDesc = dlookup("DescField", "valveMasterTable", "valveId='" & me!valveID & "'") & ""
If len(strvalveDesc)>0 then
Me!txtDesc=strvalveDesc
End if
End if
End sub
 

Users who are viewing this thread

Back
Top Bottom