Dlookup

Ringers

Registered User.
Local time
Today, 15:22
Joined
Mar 4, 2003
Messages
54
I have entered the following in the control source of a text box. But it dosen't work and every time i open the text box again in design mode, the script is missing.

I am trying to display a contact name(in a text box) from a selection made in two combo boxes, cboBranch_City, cboBranch_Name.

So what's the deal, is the deal script wrong or is it in the wrong place?

=Dlookup("[Branch_Contact]","Branch",[Branch_City] =
" & Forms!MainForm!cboBranch_City)


Thanks for any help provided.:)
 
Try This.

=DLookUp("[Branch_Contact]","Branch","[Branch_City] = [Forms]![MainForm]![cboBranch_City]")
 
Last edited:
I think you need to take the form field reference out of the quotes like this:
=DLookUp("[Branch_Contact]","Branch","[Branch_City ]=" & [Forms]![MainForm]![cboBranch_City])
but I see no reference to the cboBranch_Name field that you mentioned. If you need the DLookUp to work with that field also, you need to change the last parameter to something like:
"[Branch_City ]=" & [Forms]![MainForm]![cboBranch_City] & " And [Branch_Name]=" & [Forms]![MainForm]![cboBranch_Name]
 
Last edited:
dcx693
Whenever I've used Dlookup I could never get it to work your way even though that is the way it is described in help. I have always had to put the quotes around all of criteria part and then it works fine.
 
Nero, that's weird, but then again, I've seen Access do some really weird stuff. ;)
 

Users who are viewing this thread

Back
Top Bottom