Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AfterUpdate To Save Record? 1

Status
Not open for further replies.

RonCT

Technical User
Dec 11, 2003
37
US
I have a form where users will be updating records on a monthly basis. I want the form to prompt a user to Save Changes if they did any modifications. Currently if the user made a change, they are able to click and move to the next record. Is there an easy way to add a simple control to the form to prompt the user to Save Changes? If they say Yes, they move onto the next record. If they say No, they stay in the same record.
 

Ron,
With what I understand, you can do this. Hope it works

Create a button and on clicking the following code runs:

Dim Msg, Response, Style, Title As String

Style = vbYesNo + vbInformation + vbDefaultButton2
Title = "Information Box"

Msg = "Would you like to save?"

Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then
<save and go to next record>
else
<go back to form>
end if

 
There is a Dirty property for a form...which is true if changes have been made...use that to check if you need to prompt the user or not.

I think you'd also need to control how the user gets to the next record. That means turning off the ability to move using the buttons that access provides...and creating your own move button that you can control.

Hope that helps.

Kevin
 
I can't get it to work. I created a button and pasted your code. Any ideas of what I may be doing wrong? I am not a VB programmer. Please let me know. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top