How do i use DLookup??? (1 Viewer)

jessiep

New member
Local time
Today, 15:52
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
 

Matt Greatorex

Registered User.
Local time
Today, 18:52
Joined
Jun 22, 2005
Messages
1,019
Try

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

I believe

Me.Combo22

is suggesting that Combo22 is a property of Me, rather than a control on it.
Not saying that's the only problem, but it was the first I noticed :)
 

Steve400

Registered User.
Local time
Tomorrow, 08:52
Joined
May 1, 2013
Messages
33
You might be able to help we with a similar issue.
I'm trying to look up the key and email from the below table.
If I input 'SS' into the input box I want to lookup Key=2845 and Email=ss@1.com.au.
Code is also below.

And is there a way of setting the inputbox as a list box and listing the T1Names in the table (T1)?

Thanks

Steve

T1
Key T1ID T1Name Email
2845 1 SS ss@1.com.au
2846 2 SY sy@1.com.au
2847 3 TR tr@1.com.au
2848 4 VS vs@1.com.au
2849 5 JH jh@1.com.au
2851 8 SC sc@1.com.au
2950 7 SA sa@1.com.au

Dim Key As Long
Dim Email As Long

ToName = InputBox("Enter the name of the Customer " & _
"you want to send to:", "Import Applicant")


Key = DLookup("Key", "T1", "T1Name =" & ToName)
Email = DLookup("Email", "T1", "T1Name =" & ToName)
 

Mihail

Registered User.
Local time
Tomorrow, 01:52
Joined
Jan 22, 2011
Messages
2,373
Code:
AssignBy = DLookup("LastName", "Employees", "POC =" & Me.Combo22)
and ensure yourself that you haven't something misspelled.
 

Users who are viewing this thread

Top Bottom