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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DMax with two variables 1

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hi,
I cant get the correct syntax to use two variables in my code. I keep getting you canceled the previous operation!
With one variable i have:
Dim MyNum, MyState, MyLob
MyState = "AL"
MyLob = "CA"
MyNum = DMax("[AutoNo]", "tblMinRate", "[State] = " & "'AL'")
MsgBox MyNum
How do I add MyLob at the end of this? I have tried several ways and can't find anything in search for two variables.
Thanks
Lisa
 
It is a Where staement, without the word Where so:

[tt]DMax("[AutoNo]", "tblMinRate", "[State] = '" & MyState & "' And Lob='" & MyLob & "'")[/tt]
 
That works! I was trying to put " before Lob and that must have been giving me the error. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top