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 
Table Level Validation Rule
Gary 
      
14 years ago
For starters, I am a truck mechanic (access is a hobby) I started with a sample access database. I have a form [workorders] and added fields (mileage) and (engine hours). I do not want to close the form without added these values. My problem is that some equipment have mileage OR an hour meter OR both. If I set the required field to "yes" in the table [workorders]it always ask to enter data in that field. I created a group option [frameMiles]with opt1 = miles/ opt2 = hours/ opt3 = both. Mileage is the default. My question is...Is there a way to change the validation rule or required property depending on what option is selected. Should I add beforeupdate or afterupdate event code in [frameMiles].Any help would greatly appreciated. I have been working on this for days... any longer and I think my wife is going to go to her group option and click a different husband.


Richard Replies: Don't use the required property. You don't need an option group either.

You can set a TABLE-LEVEL validation rule to check and make sure that one or the other value has been set. This is different from (but similar to) a FIELD-LEVEL validation rule.

Open up the table in DESIGN MODE. Go to it's property sheet. In the VALIDATION RULE property, enter this:

Not IsNull([Field1]) Or Not IsNull([Field2])

Of course, replace Field1 and Field2 with your field names. Then in the VALIDATION TEXT field, put something like:

"Either Field1 or Field2 needs a value"

That's it. No crazy option groups or VBA code required.

Hope this helps.... now tell your wife that you solved your problem. She no longer has any other options. :)

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/16/2026 9:52:01 PM. PLT: 0s