Form automatically updates value

  • Thread starter Thread starter Jonathan Scott
  • Start date Start date
J

Jonathan Scott

I am programming a form where the user can input some data which can then be
saved to a field in a table. One button is for saving the changes, one is for
canceling. If the user clicks cancel, there should be no changes saved, right?
Wrong, the database contains the changes the user made.

So, why is my form updating my database without my permission? It shouldn't
do anything I haven't told it to. How can I make my form behave itself?

Second question is, why does my data disappear in the form when I tab past
the last element? Is there some kind of implicit "clear data from view" when
a user tabs past the last element on the page?

Any help would be greatly appreciated,
Jonathan Scott
 
Can you explain to me why this is happening? From what you suggest, I don't
need to explicitly save anything. But when I do try to explicitly save
something I get an error saying someone else has the record locked. What's up
with that?

Jonathan Scott

Jonathan,

Add the following to the Cancel button's Click event:
Me.Undo
...then issue the Close command.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
I am programming a form where the user can input some data which can then
be
[quoted text clipped - 15 lines]
Any help would be greatly appreciated,
Jonathan Scott
 
Jonathan,

The record is automatically saved when you move from record to record, when
the focus shifts from one form to another (or to a subform), when you close
the form, or lastly when you explicity save the record. This is the default
behaviour. If you don't want to save any changes, you have to explicitly
undo ALL changes before triggering a manual or automatic save.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Jonathan Scott said:
Can you explain to me why this is happening? From what you suggest, I
don't
need to explicitly save anything. But when I do try to explicitly save
something I get an error saying someone else has the record locked. What's
up
with that?

Jonathan Scott

Jonathan,

Add the following to the Cancel button's Click event:
Me.Undo
...then issue the Close command.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
I am programming a form where the user can input some data which can then
be
[quoted text clipped - 15 lines]
Any help would be greatly appreciated,
Jonathan Scott
 
Back
Top