Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

autonumber

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Maran - 17 Jan 2008 13:06 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.