DMax with And condition

  • Thread starter Thread starter DavidS
  • Start date Start date
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
 
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])
 
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
 
Back
Top