I've got a long and complicated problem, but what it boils down to is this -
When a user clicks on the X icon to close a form I want to throw up a question - "Exit without saving?" where either they click Yes and the form closes, any changes they made forgotten, or they click No and the form stays open, the changes they've made remain visible, but the changes are NOT saved to the database.
This is the problem: say the form is open, the user makes a change and clicks X. I put the prompt in Form_BeforeUpdate to try to capture any change saving. If they say Yes (exit without saving) then I go Me.Undo and allow the form to close. If they say No they I need to cancel the update and cancel the close (done by cancel=true in Form_Unload).
This shouldn't be a problem but when I do it, I get the error message -
This makes sense in a way I guess - Access' close procedure is to save changes then exit form. When it tries to do this "something" stops it from working as it expects (ie. I've cancelled the update), so it gives me a warning.
If I could just cancel this warning then all my problems would go away (until I find some new ones, at least!
Is this possible?
PS: I'm working on this project in Access and don't have a huge amount of experience with it, which is why I'm struggling with problems like this, and why I've been hammering this forum a little (well, like 3 questions in as many days) - once again, the help given on this board is of much value and very much appreciated. Thanks!
When a user clicks on the X icon to close a form I want to throw up a question - "Exit without saving?" where either they click Yes and the form closes, any changes they made forgotten, or they click No and the form stays open, the changes they've made remain visible, but the changes are NOT saved to the database.
This is the problem: say the form is open, the user makes a change and clicks X. I put the prompt in Form_BeforeUpdate to try to capture any change saving. If they say Yes (exit without saving) then I go Me.Undo and allow the form to close. If they say No they I need to cancel the update and cancel the close (done by cancel=true in Form_Unload).
This shouldn't be a problem but when I do it, I get the error message -
You can't save this record at this time.
Microsoft Office Access may have encountered an error while trying to save a record.
If you close thie object now, the data changes you made will be lose. Do you want to close the database object anyway?
Yes No
This makes sense in a way I guess - Access' close procedure is to save changes then exit form. When it tries to do this "something" stops it from working as it expects (ie. I've cancelled the update), so it gives me a warning.
If I could just cancel this warning then all my problems would go away (until I find some new ones, at least!
Is this possible?
PS: I'm working on this project in Access and don't have a huge amount of experience with it, which is why I'm struggling with problems like this, and why I've been hammering this forum a little (well, like 3 questions in as many days) - once again, the help given on this board is of much value and very much appreciated. Thanks!