Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Form Validation with VBA
Edd 

16 years ago
Hi,

I've put together a db application in Access 2003. The data input form I have put together uses the standard Access negotiation buttons at the bottom of the form to move through the records and create a new entry. The table captures impacts recorded against pieces of work which are stored in 3 other tables. Therefore I have 3 dropdown boxes on the form which are populated by the primary keys of the 3 related tables. What I would like to do is create a piece of code which disables 2 of the drop down boxes whenever a value is entered into any one of the 3. In onter word prevent users from entering a value into more than 1 of the 3 column in the maini table. I have tried using snippets of code that I have found online but have not had very much joy. Any help is appreciated.


Answer from Richard Rost:

You need to put an AfterUpdate event in all three of your combo boxes which sets the other combo boxes to be disabled:

ComboBox2.enabled = FALSE
ComboBox3.enabled = FALSE

Then in the OnCurrent event (which runs when you move to a new record) you will need to RE-enable all three of them.

Here's a tutorial which will teach you more about the AfterUpdate event:

You can use an AfterUpdate or BeforeUpdate event to set values, change properties, run macros, and do lots of other cool things.

The major difference between the two is that BeforeUpdate runs BEFORE the data is saved to the table, which allows you to CANCEL the update if the data is not valid. AfterUpdate runs after the data is saved to the table.

Please see the following FREE video tutorial on my web site for step-by-step instructions on how to create an AfterUpdate event:

http://599cd.com/tips/access/afterupdate-event-vba?key=BlFAlEx

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

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/31/2026 9:13:17 PM. PLT: 1s