One of the basic rules of the universe is that nothing is perfect. Perfection simply doesn't exist. Without imperfection, neither you nor I would exist.
Clarification Needed PleaseUpload ImagesLink Sandra Truax 10 months ago
In my notes, to make sure the record is saved before closing, I have
Put DoCmd.RunCommand acCmdSaveRecord in the Deactivate Event
AND I have
Put DoCmd.Save in the Unload Event.
Which is better, and why?
Signed, Confused again :)
Adam Schwanz 10 months ago
I just do Me.Refresh :P or If Me.Dirty=True then Me.Dirty=False
Sandra Truax 10 months ago
Thank you once again Adam! Quick question, which Event do you put the Me.Refresh in?
Adam Schwanz 10 months ago
No problem, unless you have some kind of error catching stopping the error, it's going to save when you close it. If it can't, it will tell you that it can't because of whatever. So I don't usually do that. I might put it in a field that needs to save right away, like our serial number field, when they put one from stock into a sold record it needs to come out of stock immediately so two people don't try to snag the same one, so it does me.refresh in those after update events. I suppose if I was going to use it near the end, it would be in like a "close" button. Putting it in a closing event seems kind of pointless because you're telling it to save the record and that is what it was already doing when it was closing. I guess if you wanted to put it somewhere in there anyways though, probably the unload event?
Adam Schwanz 10 months ago
Maybe something like
Me.Refresh
If Me.Dirty=True Then Cancel=True
'record didn't save for some reason
Sandra Truax 10 months ago
Adam,
Sounds like I'm either worrying about stuff I don't need to, or just looking for a reason to use VBA. I have learned so much and love it. Thanks to you and the others helping when I'm not sure. Hope you have a wonderful and blessed day. You're awsome!
Kevin Yip 10 months ago
How and when to save depends on what kind of user interface you want to give your users. If you look at many of today's commercial software, a user entry is often saved *the moment* the user makes the entry. There may be an Undo button, but there is no "Save" button like in the old days. If your users are used to that, they may expect or want your forms to behave that way. In a typical Access operation, if a user edits a form and stays on the form, he may not realize the form isn't saved until he either goes to another record on the form or closes the form. So to design a proper user interface, you need to understand your users first.
Sandra Truax 10 months ago
Thanks Kevin, for the clarification. That makes a lot of sense and clearer. Thanks for taking time to help me. You're awsome also! I used to think I was pretty good at programming, but now realize I don't know diddly squat! But I'm learning a little more each day. :)
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.