Save or Cancel Prompt

Fiona

New member
Local time
Today, 06:11
Joined
Aug 28, 2000
Messages
7
I Expect there is a really simple answer but I am quite new to this so please bear with me. On one of my forms I have put in code that prompts the user to save or cancel the changes on closing. I am using a simple If Me.Dirty statement and I have put it in the On Click property of the Close button. However this only works when the record is closing - how do I get the same code to work when the user is clicking through from one record to another making changes without closing the form?
I am pretty much self taught - what glaringly obvious thing am I missing?
Thanks in anticipation,

Fiona
 
Call the On Click prodedure of the button from the On Current event of your form:

Private Sub Form_Current()
Call cmdYourCloseButton_Click
End Sub

Change "cmdYourCloseButton" to the name of you Close button.

This will cause the code attached to the Close Button to run when you change records.

HTH
RDH

[This message has been edited by R. Hicks (edited 10-27-2000).]
 
Pat, I stand corrected. I should have thought the process through before replying.

You know, your knowledge of Access scares me to death sometimes!!!!!!

Thanks for correcting me,
RDH
 
Thanks Pat,
I have moved the code to the before update bit and it works really well. However, there are save and cancel buttons on the form as well and if the user clicks these they get the message box asking them to save the record. Is ther any way I can avoid this?
Thanks again,

Fiona
 

Users who are viewing this thread

Back
Top Bottom