Computer Learning Zone CLZ Access Excel Word Windows

We are just an advanced breed of monkeys on a minor planet of a very average star. But we can understand the Universe. That makes us something very special.

-Stephen Hawking
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to TechHelp    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Clarification Needed Please
Sandra Truax 
         
4 years 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  @Reply  
           
4 years ago
I just do Me.Refresh :P or If Me.Dirty=True then Me.Dirty=False
Sandra Truax OP  @Reply  
         
4 years ago
Thank you once again Adam! Quick question, which Event do you put the Me.Refresh in?
Adam Schwanz  @Reply  
           
4 years 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  @Reply  
           
4 years ago
Maybe something like

Me.Refresh
If Me.Dirty=True Then Cancel=True
'record didn't save for some reason
Sandra Truax OP  @Reply  
         
4 years 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  @Reply  
     
4 years 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 OP  @Reply  
         
4 years 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. :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in TechHelp.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:21:44 PM. PLT: 1s