Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup: What am I doing wrong? 1

Status
Not open for further replies.

mkrets

Technical User
Aug 28, 2007
15
US
I'm trying to set the value of a text field on the AfterUpdate event of a combo box with:

Me.txtCustName = DLookup("[CustName]", "tblCustomers", "[IntCustNum] = '" & [cboIntCustNum] & "'")

But I keep getting a data mismatch error.

Is there something wrong with the format of my Dlookup?
 
My guess is that the intCustNum field is an integer, so the apostrophes aren't needed around it.

Code:
Me.txtCustName = DLookup("[CustName]", "tblCustomers", "[IntCustNum] = " & [cboIntCustNum])

John
 
Isn't it:
Me!txtCustName = DLookup("[CustName]", "tblCustomers", "[IntCustNum] = " & Forms![Formname]![cboIntCustNum]

Put your formname in.
 
Thanks jbarnett, that was the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top