I wrote the below code, in the before update event in an option group. The
name of the option group is Meetings.
The after update , event group has macro, which will open a new form where
the user can update data. I want to restrict, the user from clicking the form
unnecessarily, because,
It will cause, the autonumber to generate, even if the user clicks it
wrongly, because, I have given, in the macro gotorecord as , , New,
Private Sub MEETINGS_BeforeUpdate(Cancel As Integer)
Dim MSG As String
MSG = MsgBox("YOU ARE TRYING TO CHANGE THE DATABASE!!", vbOKCancel)
If MSG = 1 Then
Dim MSG1 As String
MSG1 = MsgBox("MAKE SURE YOU HAVE UPDATE THE COMPANY NAME", vbOKCancel)
If MSG1 = 1 Then
Dim stDocName As String
stDocName = "HOLD_MEETINGS.DIF_MEET"
DoCmd.RunMacro stDocName
Else
Undo
Else
Undo
End If
End If
End Sub
Douglas J. Steele - 17 Jan 2008 13:22 GMT
That's the way Access works: even if you don't save the record, the fact
that you started to work on it causes the Autonumber to be generated (and
lost).
It shouldn't matter, though. The only point of an Autonumber is provide a
(practically guaranteed) unique value that can be used as a primary key.
Whether there are gaps in the numbering doesn't impact that purpose. If
you're trying to assign some meaning to the value of the Autonumber field,
you probably shouldn't be using an Autonumber.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I wrote the below code, in the before update event in an option group. The
> name of the option group is Meetings.
[quoted text clipped - 40 lines]
>
> End Sub