Dlookup Not working

jessiep

New member
Local time
Yesterday, 23:50
Joined
Jul 6, 2006
Messages
7
I am using Dlookup to look up LastName, I have

AssignBy = DLookup("[LastName]", Employees, "POC =" & Me.Combo22)

I am getting an ERROR ""You entered an invalid argument in a domain aggregate function"

I need AssignBy = LastName from Employees Table where POC=what is selected in Form for Combo22.

ex. POC=3 go to Employees Table find POC that equals 3 and get the LastName.

Please Help!!

Jessie
 
if your field [POC] is a text field then use

AssignBy = DLookup("[LastName]", "Employees", "[POC]='" & Me.Combo22 & "'")

if the field is numeric then use

AssignBy = DLookup("[LastName]", "Employees", "[POC]=" & Me.Combo22)
 
Can i suggest using difinitive names for text boxes and combo boxes? This is so that when other people need to edit your project for whatever reason, they wont need to do much work to find out what this bit of code does

So if the combobox included a list of colours, it could be called cmbColours for example.

Your code would then be:

AssignBy = DLookup("[LastName]", "Employees", "[POC]='" & cmbColours & "'")
(as said by allan)

Sorry if this sounds naggy or spam, but my colleague coded a form for me a while ago and i had no idea what the hell was going on, and i missed my deadline by a week because of it.

Happy Development!
 

Users who are viewing this thread

Back
Top Bottom