Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2003
    Location
    Summerville, South Carolina, USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clearing a record (Access 2000)

    I have a form that is used for doing a survey. It has a primaryid that is set as an AutoNumber. What I would like to happen is create a cancel button so that if the user decides to start over he or she can. I also don't want the record saved because I have to run reports off of what is entered. I tried using the onclick method to docmd.runcommand accmddeleterecord but it is giving me an error stating that it not available to run at this time. Is there an efficient way to do this? Any help would be greatly appreciated.

  2. #2
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clearing a record (Access 2000)

    The "UNDO" Method sounds like what you want. (Taken from Help Files)

    The next example uses the Undo method to reset all changes to a form before the form is updated.

    Private Sub Form_BeforeUpdate(Cancel As Integer)

    Me.Undo

    End Sub

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Clearing a record (Access 2000)

    The prior response indicates a method for doing a cancel programatically, but the ESC key hit twice also does the same thing. Is one of your objectives to avoid using an autonumber value and not ending up with holes in the sequence? If so, neither method accomplishes that - in fact autonumbers are assigned the moment you begin adding a record, and are not recovered in any method other than a database compact, and even that is dubious as many version of the JET engine do not reset the autonumber to the next available number. If the unique ID is your primary concern, there are other methods we can point you to.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •