G
Guest
I’m using Access 2003 with Access 2000 file format.
I’m getting an error message “Run-time Error ‘2001’: You canceled the
previous operation’ when using a Where Clause with DMAX in VBA.
The code is:
Me.txtOrder = DMax("[OOrder]", "tblOCode", "SCode = " & Me.Parent.SCode) + 1
This code works without errors when I don’t include the Where Clause
portion. I’ve looked for the error in the Microsoft Knowledge Base but do
not find any reference. I probably have some problem with the quotes.
txtOrder is a control in the form that holds the sequential numbers, the
numbers should be sequential for each unique SCode.
OOrder is the field in the table tblOCode that holds the sequential numbers.
SCode is a foreign key field in table tblOCode and a primary key field in
tblSCode. SCode is unique in tblSCode. tblSCode and tblOCode have a one to
many relationship.
I’ve read many posts regarding sequential numbers in this group and others
like it and found similar code, but continue to get error message.
TIA
I’m getting an error message “Run-time Error ‘2001’: You canceled the
previous operation’ when using a Where Clause with DMAX in VBA.
The code is:
Me.txtOrder = DMax("[OOrder]", "tblOCode", "SCode = " & Me.Parent.SCode) + 1
This code works without errors when I don’t include the Where Clause
portion. I’ve looked for the error in the Microsoft Knowledge Base but do
not find any reference. I probably have some problem with the quotes.
txtOrder is a control in the form that holds the sequential numbers, the
numbers should be sequential for each unique SCode.
OOrder is the field in the table tblOCode that holds the sequential numbers.
SCode is a foreign key field in table tblOCode and a primary key field in
tblSCode. SCode is unique in tblSCode. tblSCode and tblOCode have a one to
many relationship.
I’ve read many posts regarding sequential numbers in this group and others
like it and found similar code, but continue to get error message.
TIA