Bawn
Bawn

Reputation: 509

" #Name? " error in access using DLookup

enter image description here

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

Answers (1)

Gord Thompson
Gord Thompson

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

  1. it makes them easier to find in an IntelliSense list, and

  2. 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

Related Questions