DMax with And condition

D

DavidS

I've tried every way possible to figure this one out.
ItemNo is a text value on the record.
GraphedID is a numeric long on the record.
I call this from a record in acontinuous subform,
looking for a max value from among that subform's records.

Dim LastLocation As Integer
LastLocation = DMax("[DefectLocation]", "tblDefectsGraphed",
"ItemNo = " & [ItemNo] & " And GraphedID > " & [GraphedID]")

Continue to get "Type mismatch in expression"

I've tried many combinations of quoting and combinig these
elements. Also tried several solutions I found in the Google
Groups, but no luck.

Any suggestions?
Thanks
Steve
 
S

Steve

ItemNo needs to be enclosed in single quotes since it is a string and no
quotes after the second GraphedID.

"ItemNo = '" & [ItemNo] & "' And GraphedID > " & [GraphedID])
 
D

DavidS

Thanks Steve,
I had & [ItemNo] & ' " with the single quote inside
the double.

Thankyou for the help,
Steve

Steve said:
ItemNo needs to be enclosed in single quotes since it is a string and no
quotes after the second GraphedID.

"ItemNo = '" & [ItemNo] & "' And GraphedID > " & [GraphedID])


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1175 users have come to me from the newsgroups requesting help
(e-mail address removed)

DavidS said:
I've tried every way possible to figure this one out.
ItemNo is a text value on the record.
GraphedID is a numeric long on the record.
I call this from a record in acontinuous subform,
looking for a max value from among that subform's records.

Dim LastLocation As Integer
LastLocation = DMax("[DefectLocation]", "tblDefectsGraphed",
"ItemNo = " & [ItemNo] & " And GraphedID > " & [GraphedID]")

Continue to get "Type mismatch in expression"

I've tried many combinations of quoting and combinig these
elements. Also tried several solutions I found in the Google
Groups, but no luck.

Any suggestions?
Thanks
Steve
 

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