C
crmulle
I am struggling with a general lookup function. I want the user to be able
to look up a vendor id or name from field with in a form and have the form
populate with the correct vendor information. The fields (ex. Vendor ID,
Owning LOB, Risk Rating, Service Category, etc.) in this form are bound to a
table named tblImport This information in this table is static and doesn't
change until the monthly upload is complete. Therefore, a user shouldn't be
able to edit the information
When I set up a combo box it allows me to edit the Vendor ID field (which
changes the tblImport table) and doesn't populate the other fields properly
in the form.
I tried using a dlookup and am stuck. I have included my code below, but I
am not understanding the help information on dlookup...specifically the
criteria portion of the dlookup. Would someone be able to give me some
direction on how to resolve this?
DLookup("[Vendor ID]", tblImport, "[Vendor ID]" = Forms!frmMain2!VendorId)
PS - I even tried using an input box but they only accept strings and not
numbers...correct? I have included my code for that as well.
Dim strVendorId As Variant
strVendorId = InputBox("Please enter the desired Vendor ID:", "Find")
DoCmd.GoToRecord "strVendorId"
to look up a vendor id or name from field with in a form and have the form
populate with the correct vendor information. The fields (ex. Vendor ID,
Owning LOB, Risk Rating, Service Category, etc.) in this form are bound to a
table named tblImport This information in this table is static and doesn't
change until the monthly upload is complete. Therefore, a user shouldn't be
able to edit the information
When I set up a combo box it allows me to edit the Vendor ID field (which
changes the tblImport table) and doesn't populate the other fields properly
in the form.
I tried using a dlookup and am stuck. I have included my code below, but I
am not understanding the help information on dlookup...specifically the
criteria portion of the dlookup. Would someone be able to give me some
direction on how to resolve this?
DLookup("[Vendor ID]", tblImport, "[Vendor ID]" = Forms!frmMain2!VendorId)
PS - I even tried using an input box but they only accept strings and not
numbers...correct? I have included my code for that as well.
Dim strVendorId As Variant
strVendorId = InputBox("Please enter the desired Vendor ID:", "Find")
DoCmd.GoToRecord "strVendorId"