AND - problem with "s

Malcy

Registered User.
Local time
Today, 08:23
Joined
Mar 25, 2003
Messages
584
Hi
I need to construct a DLookup using two numeric fields and cannot get the syntax right. Sorry but could someone point me. I think I have just about tried every combination I can think of but I still cannot get it.
The code I currently have is
Code:
' Define variables
    strSQL = "[lngConId] = " & Me.txtConId And [lngExp] = Me.cboExpType
' Verify that there is not already a relevant entry in tblExpenditure
    varExp = DLookup("lngExpId", "tblExpenditure", "strSQL")
I tried separating the SQL off to a variable to see if I could get it to work that way but not sure if this is the best approach.
If you can help it would be much appreciated.
Thanks and best wishes
 
Malcy,
Try this

' Define variables
strSQL = "[lngConId] = " & Me.txtConId & " And [lngExp] = " & Me.cboExpType
' Verify that there is not already a relevant entry in tblExpenditure
varExp = DLookup("lngExpId", "tblExpenditure", strSQL)

Might work

Take Care

Carl
 
Brilliant
Thanks very much
I think I must have a form of " & SQL dyslexia"
Thanks for taking time
Best wishes
 

Users who are viewing this thread

Back
Top Bottom