Hi

This select works:
Set grstCurrentRS = gdbCurrent.OpenRecordset("Select * from tblOrderMaster where fldCustomerID like " & "'*" & glngCustomerID & "*'")

Then I can do this and it works
txtOrderID = MR_OS.grstCurrentRS![fldOrderID]

So I slightly changed that select to include a Max(field) and now I get an error

Set grstCurrentRS = gdbCurrent.OpenRecordset("Select MAX(fldOrderID) from tblOrderMaster where fldCustomerID like " & "'*" & glngCustomerID & "*'")

The Error says Item not found in this collection
and points to

txtOrderID = MR_OS.grstCurrentRS![fldOrderID]

Why cant I show the Max fldOrderID in that text box now.
When you use an aggregate operator like Max( it returns the Max value from that field according to all the info I have found, but I havent been able to figure out how to retrieve the results without an error.I tried to put the results into a variable also among other things and that does not work either
ex:
glngMaxOrderID = grstCurrentRS

and it said type mismatch

the fldOrderID is of type long