Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > TechHelp > Directory > Access > Default Button < Table of Contents 3 | Images Subfolder >
Back to Default Button    Comments List
A VBA example Upload Images   Link   Email  
Thomas Gonder       
4 months ago
I've set up most of my forms for previewing when first opening. Permissions allow a user to edit or not. I've found that most new users like to just cruise through the records at first (seasoned users go right to the search form). I have a Next button to do that. It's set as the default, so that after opening a form, just press enter and preview to your heart's content.

You can't see it in the next image, because the minute I take an image, the Next loses focus, but in the live version you would see the command button surrounded by little black dots.
Thomas Gonder       
4 months ago

Thomas Gonder       
4 months ago
The code snippent below appears quite complicated, but it's just testing if a control is on the form, if the user has permissions, activates it and sets the focus. For the focus line, look for the orange bit. Just name the control and add .SetFocus. This code runs in the Private Sub Form_Current() procedure of the form. The crazy name for the control is how I handle the multi-language and helps for the form.
Thomas Gonder       
4 months ago

Richard Rost             
4 months ago
Cool. Thanks for sharing!
Thomas Gonder       
4 months ago
A final note: I've used .SetFocus a lot, and had a lot of problems within VBA code using it. It tends to throw a lot of different RTEs. Sometimes in a way that isn't very consistent. As with other similar RTEs, I suspect the run-time of VBA ties itself up into a knot and sh!ts itself. On my to-do list is "write a procedure for doing .SetFocus" so that my .accde doesn't just die an ignoble death (even though it ran hundreds of times before without a problem). It seems crazy to have to write new procedures or a bunch of On Error Goto in lots of procedures, but that's what I'm having to do with all the odd RTEs.
Richard Rost             
4 months ago
I agree. Moving focus around a form is a good way to throw weird random errors. I try to avoid it if possible.

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


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

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

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/16/2024 4:41:37 AM. PLT: 1s