Inrementing a field on a new record. (1 Viewer)

L'apprentis

Redcifer
Local time
Today, 09:24
Joined
Jun 22, 2005
Messages
177
Hi everybody,
I have written a small procedure to increment one of my field by 1 each time the new record button is pressed but I keep getting the following Message:
"You Canceled the previous operation"

Here is the code:
Code:
Private Sub CmdNew_Click()
 Dim inumber As Integer
    DoCmd.GoToRecord , , acNewRec 
    inumber = Nz(DMax("[EnquiryNo]", "TblEnquiry"), 0)
    Me.TxtEnquiry = inumber + 1
Me.TxtEnquiry.SetFocus
End Sub
Does anybody know why I am getting this message?
 

Ron_dK

Cool bop aficionado
Local time
Today, 18:24
Joined
Sep 5, 2002
Messages
2,141
I remember that this error could be eliminated thru importing your db into a new blank one. Also try compact and compile your VBa.
You could do a search on this forum on : "canceled previous operation".

Hth
 

Users who are viewing this thread

Top Bottom