Syntax Help

  • Thread starter al416 via AccessMonster.com
  • Start date
A

al416 via AccessMonster.com

Having a brain cramp.

I know its a simple syntax error, but why won't the following statement work
in VBA code?

LastAuditNumber = DMax("[AuditNumber]", "tblCARs", "[CARNumber] = MaxCAR1")

MaxCAR1 needs to enclosed in some kind of single or double quotes. right?
 
A

Al Campagna

al416,
If MaxCar1 is a text field try...
LastAuditNumber = DMax("[AuditNumber]", "tblCARs", "[CARNumber] = ' " &
MaxCAR1& " ' ")

(I left spaces between the quotes for clarity... remove from actual syntax)
LastAuditNumber = DMax("[AuditNumber]", "tblCARs", "[CARNumber] = '" &
MaxCAR1& "'")
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top