D
davwhsdb
Like the subject states, I want to use DLookup to populate a text box.
My main form is called Inquiry Portal, and I have a combo box on it
called InquiryNumber. When an inquiry number is selected from the
combo box, I want my text box to look in the InquiryHeader table and
pull the Initiated_By field that corresponds to the selected inquiry
number. The primary key that links all these tables is called
Inquiry_Number (confusing, huh?)
I wrote this DLookup statement to do this:
DLookup("[Initiated_By]", "InquiryHeader", "InquiryNumber =
Forms!InquiryHeader!Inquiry_Number")
Is the syntax of this statement correct?
Where do I put the statement? At first I put it in the data
ControlSource for the text box, but I don't think that will capture
changing the combo box. Should I put it in the On Change event for the
combo box and reference the text box? Like
me.txtbox.value = DLookup("[Initiated_By]", "InquiryHeader",
"InquiryNumber = Forms!InquiryHeader!Inquiry_Number")
I plan on having multiple text boxes that populate this way, so would I
just put a bunch of these statements in the combo box's On Change
event?
Thanks,
David
My main form is called Inquiry Portal, and I have a combo box on it
called InquiryNumber. When an inquiry number is selected from the
combo box, I want my text box to look in the InquiryHeader table and
pull the Initiated_By field that corresponds to the selected inquiry
number. The primary key that links all these tables is called
Inquiry_Number (confusing, huh?)
I wrote this DLookup statement to do this:
DLookup("[Initiated_By]", "InquiryHeader", "InquiryNumber =
Forms!InquiryHeader!Inquiry_Number")
Is the syntax of this statement correct?
Where do I put the statement? At first I put it in the data
ControlSource for the text box, but I don't think that will capture
changing the combo box. Should I put it in the On Change event for the
combo box and reference the text box? Like
me.txtbox.value = DLookup("[Initiated_By]", "InquiryHeader",
"InquiryNumber = Forms!InquiryHeader!Inquiry_Number")
I plan on having multiple text boxes that populate this way, so would I
just put a bunch of these statements in the combo box's On Change
event?
Thanks,
David