FYI

This works I had to use an alias to get it to work

Public Sub GetMaxOrderID()
'using a select max with an alias as max_order to get the max value from fldOrderID and store it in a variable
Dim RS As Recordset
Dim plngMaxOrderID
Set RS = gdbCurrent.OpenRecordset("Select MAX(fldOrderID) AS MAX_ORDER from tblOrderMaster " & _
"Where fldCustomerID Like " & " '*" & glngCustomerID & "*'")
plngMaxOrderID = RS![MAX_ORDER]
glngNewOrderID = plngMaxOrderID + 1
RS.Close
End Sub


txtOrderID = glngNewOrderID

[Edited by VB_Sponge on 04-24-2000 at 07:32 AM]