autonumber

M

Maran

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
 
D

Douglas J. Steele

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top