Results 1 to 8 of 8
  1. #1
    onaggar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3

    Post Closing access database without saving

    Hi all friends,

    I have access database witch contains tables and forms ... since press x button to close the whole file, It save automatically changes .. I want to exit without saving changes at either tables or forms ..

    already thanks for help ...

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    You want to close db without saving design modifications? Pressing X triggers a 'Do you want to save changes' prompt.

    Why would you want this?
    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
    onaggar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3

    Post

    Quote Originally Posted by June7 View Post
    You want to close db without saving design modifications? Pressing X triggers a 'Do you want to save changes' prompt.

    Why would you want this?
    June7, Thanks for responding, Actually users only change data in records and forms and print it, and when they press X and 'Do you want to save changes' prompt is displayed, might be press "yes" and save new data ( not design changing at all )

    and this what i want to prevent i.e. closing directly without prompt displayed and keep the original data

    I made same case at excel by this code:
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ActiveWorkbook.Saved = True
    End Sub

    i want same action but for access

    thanks for interactive

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    The prompt appears only because of design changes, not data entry/edit. What you describe is not necessary for Access. Data is saved automatically. Data entry/edit is committed to table when table/query/form closes or move to another record or explicitely by code.
    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
    onaggar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3
    Excuse me because I am new at vba,

    I noticed as you said " data is saved automatically " and i want to prevent this property or make it only by password .. how i can do that?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Securing Access database to prevent interaction is not easy. A login form is common topic in forum, do a search. However, be aware that holding down shift key while opening an accdb file will override most security project settings and coding and allow full interaction. Disabling the shift key is tricky. Do it wrong and you (the developer) will be locked out of db forever.

    The point is, once someone is in the db with full access preventing data edit is virtually impossible.

    There is option to publish the db as an executable that is not subject to design edits and code cannot be overridden but I have never done that.
    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.

  7. #7
    katmomo5 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    47
    Hi June, if a person would like to exit out of a form without saving the data entered (changed their mind, or needs more info...)is there a way to close the form without saving? I saw the thread about creating a macro for undo, but it is not working for me, and looks like it did not work exactly the way the original person wanted either.
    Thanks

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    That should be possible, but I don't have it implemented anywhere. I tried early in my VBA learning but had problems as well and went a different route.

    Do you allow users to close form with X button? I always disable it and provide custom buttons.

    This seems to work:

    Option Compare Database
    Option Explicit
    Dim intSave As Integer

    Sub btnCancel_Click
    intSave = 1
    DoCmd.Close acForm, Me.Name, acSaveNo
    End Sub

    Sub Form_BeforeUpdate(Cancel As Integer)
    If intSave = 1 Then
    Cancel = True
    Me.Undo
    End If
    End Sub
    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.

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

Similar Threads

  1. Problem Saving Access 2007 to 2003 database
    By spkoest in forum Access
    Replies: 4
    Last Post: 05-03-2011, 04:44 PM
  2. Saving Access 2010 database to Access 2007
    By Bajaz001 in forum Access
    Replies: 2
    Last Post: 04-11-2011, 12:59 PM
  3. Confirming closing database
    By Uudistaja in forum Forms
    Replies: 10
    Last Post: 03-01-2011, 02:28 PM
  4. Closing and saving a form
    By Lxmanager in forum Forms
    Replies: 14
    Last Post: 11-21-2010, 02:04 AM
  5. Replies: 1
    Last Post: 03-24-2010, 08:48 AM

Tags for this Thread

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