Results 1 to 5 of 5
  1. #1
    terrythomasvda is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    2

    saves data with out click "Save" button in forms

    hi,
    how to stop access saves data with out click "Save" button in forms. in my form i have "Save", "close" and "Home" button which i created from control wizard, when ever i click any button or close my form data saved in my table. i want only to save when i click "Save" button.


    as per one of ur previous comment i enterd below code in the mail form after that it is not saving any data in table even i click "Save" button.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Not Save Then
    Me.Undo
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Record is committed to table when form closes, move to another record, or by code. I don't understand 'If Not Save Then'. What is 'Save'? You are trying to detect if it was the Save button that was clicked. Never seen any code for that. I used Cancel and Save/Close buttons on my form. If user decides to Cancel data entry then code in Cancel button undoes the entries and record is not committed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    terrythomasvda is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    2
    Quote Originally Posted by June7 View Post
    Record is committed to table when form closes, move to another record, or by code. I don't understand 'If Not Save Then'. What is 'Save'? You are trying to detect if it was the Save button that was clicked. Never seen any code for that. I used Cancel and Save/Close buttons on my form. If user decides to Cancel data entry then code in Cancel button undoes the entries and record is not committed.

    "Save" the command button which i user in the form and in the form i am not using cancel button.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Believe I understand what you are doing and I am suggesting that is not practical, hence the description of what I do is offered as an option.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    roaftech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2012
    Location
    Romania
    Posts
    65
    I reiterate what June7 says - better to use the wizard to create a Cancel button and then you know the code is going to work. You can set the Cancel button to be the default if you wish.
    Otherwise you are into writing modified code for all your "non-saving" buttons, which introduces unneccesary complexity and, as you have found, a high likelihood of unanticipated errors. Remember, the software does only what you specifically tell it to - not what you think you told it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 04-26-2012, 08:25 PM
  2. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  3. Using "On Click" or "On Dbl Click" in a Switchboard
    By James Parker in forum Access
    Replies: 2
    Last Post: 01-12-2012, 11:00 AM
  4. Replies: 0
    Last Post: 01-11-2012, 12:34 PM
  5. Replies: 3
    Last Post: 10-21-2010, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums