Michael Noze
asked on
Access Form Dlookup - Using a Combo box for the expression value
Hi Experts,
I'm trying to populate a text box with a Dlookup based on a combobox value.
Informations:
Form containing the combobox: frmInspection
combobox: cboEquipment
table: tblEquipment
Unique ID in the table: [EquipementID]
Field wanted in the textbox: [HS]
This is the code I've tried but didn't work:
I'm trying to populate a text box with a Dlookup based on a combobox value.
Informations:
Form containing the combobox: frmInspection
combobox: cboEquipment
table: tblEquipment
Unique ID in the table: [EquipementID]
Field wanted in the textbox: [HS]
This is the code I've tried but didn't work:
Set rst2 = CurrentDb.OpenRecordset("tblEquipment")
With rst
Forms("frmInspection").Form.Controls("txtHS") = _
DLookup(.Fields("HS"), "tblEquipment", Forms("frmInspection").Form.cboEquipement = _
.Fields("HS"))
Wend
End With
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER