Results 1 to 4 of 4

Thread: Save button

  1. #1
    Join Date
    Jul 2013
    Posts
    19

    Unanswered: Save button

    I have a Save button with the following code behind it:

    If Me.Dirty Then
    DoCmd****nCommand acCmdSaveRecord
    MsgBox "Record saved!"
    Exit Sub
    End If

    What it’s happening is that I also have a before_Update procedure to catch the user leaving the form “dirty”. Well, after the save procedure does DoCmd****nCommand acCmdSaveRecord, it jumps to the Before_Update procedure and there it asks if I want to save the record.

    How can I tell it in the Save procedure not to go to the Before_Update if the record has been saved?

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    If Me.Dirty = True Then
    Exit Sub
    End If

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by jema53 View Post

    ...How can I tell it in the Save procedure not to go to the Before_Update if the record has been saved
    You can't! The Record has not been saved until the Form_BeforeUpdate event executes! Your 'save' code merely initiates the saving process! And since 'save' buttons can be hit accidentally, the BeforeUpdate code is still appropriate.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jul 2013
    Posts
    19
    Thanks for your reply.

Posting Permissions

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