Reputation: 509
What I am trying to do is to have a value("Element" which is a primary key) from my Elements table be inserted into the time textbox based on the result from the previous combox.
Is this the write snytax to achieve this ??
=DLookUp("[Time]","[Elements]","[Element]=" & [Forms]![1 Cut Wire and Cable Only]![Element])
Upvotes: 1
Views: 6828
Reputation: 123664
I suspect that there is a mismatch between the name of your combo box control and name you use in your DLookup. Try changing the combo box control's Name to cbxElement
and then using
=DLookUp("[Time]","[Elements]","[Element]=""" & [cbxElement] & """")
for the Control Source of the text box. Note that it is usually a good idea to use a prefix like "cbx" for combo boxes, "txt" for text boxes, etc., because
it makes them easier to find in an IntelliSense list, and
it avoids potential conflicts when the name of a control is identical to the name of a field in the underlying record source.
Upvotes: 2