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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating records in forms

Status
Not open for further replies.

lexis7

Programmer
Sep 23, 2002
26
US
I have a form which shows the results of a query. I want users to be able to update the information on that form.

If the user just types the new info on the form it works, (the table updates), but i want a msgbox asking them if they want to update first before any changes occur.

I just don't know where to put the code for the msgbox.

Any help would be great. Thanks.
 
How do you update without any change? If you are basing your form on the result of an action query, the update has already happened. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
ok- let me try to be more clear.

I have users search for an invoice number, and the result of the search pulls up all the information about that invoice on a form. They can then change/add/delete any information on that form and it updates the changes made in the table.

I want a msgbox to pop up asking if they are sure they want to update that invoice when they change/add/delete any information on the form.

I hope this makes things understandable. Thanks!
 

Lexis,

Thank you for the explanation. You can do this in 2 ways. The method I prefer is not a message box, but a cancel button on the form. If they click the cancel button, the on click event of the button contains one line of code,

Me.undo

which literally resets your form to the values prior to making any change on the form.

If you wish to use a message box use the forms before update event and use the following code.

If me.diry = true then ‘the form has been changed
If (Msgbox “Do you want to accept changes”, vbinformation + vbokcancel) = vbcancel then
Cancel = true ‘ cancels update
Exit sub
Endif

HTH
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top