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 
Required Property
William Farrar 
    
4 years ago
I designed my tables without setting some of the fields  "required" property setting to yes.  After I went back and changed that setting to "Yes", the current form(s) do not enforce the new property setting in the table.  I could not locate a "Required" property setting in the Form Property Sheet. I also closed down the database and restarted it.

I really don't want to edit the table(s) property setting and recreate all of the forms.  

1). Is there a VBA solution that could be written into a module passing the FieldName as a variable? 2). What "Event" should be used to trigger the VBA Code?

Richard Rost  @Reply  
           
4 years ago
If you set the field to Required in the table, then you don't have to change all the forms.
William Farrar OP  @Reply  
    
4 years ago
I did exactly that; however, the form continues onto the next field. When a click on the "Save" Button: (DoCmd.Save, DoCmd.Close); it does not give you an error for the missing required fields!  Then upon opening the corresponding table, that record isn't listed in the table.   Never received any type of error from Access.   I went into the Options and turned on all three settings under Confirm.  Closed and reopened the database and tried again; still receiving no error message, and no no new record added to underlying table.  I'm using Office 2019 Professional Pro edition.
Scott Axton  @Reply  
        
4 years ago
William when you change mid-stream the existing records don't get updated.  You should have to update them manually.
If you enter a new record then the required will kick in.
Is that what is happening to you?
William Farrar OP  @Reply  
    
4 years ago
No; I've completely closed the database base, selected the form which adds a new record and intentionally skipped the required fields.  If I use the Button that I created, no error message or new record saved into table.

Upon further testing, if I close the form using the right mouse click options, then I do receive an error message on the required field.  After confirmation of  the Access error, another Access message pops up (Yes/No) and states that the record can't be saved at this time.

In my research, I located another content provider who created a macro that provides a "readable" error message and then returns the cursor (DoCmd.GoToControl "FieldName") to the required FieldName.  The cursor will not move away until a value is entered into that field name.  That's when I came up with the idea of a VBA module (passing the FieldName as a variable) so it can be in multiple fields and forms.

Also, how do I access the Code Vault?  I haven't figured out the navigation to it.
Scott Axton  @Reply  
        
4 years ago

Scott Axton  @Reply  
        
4 years ago
Two spots for Code Vault  Up top  Combo Box next to Order.  Down at the bottom in the Info Section.

I'll have to take a look and see what I can find.  I tend to not set required because as Richard says "no data is better than Bad data".  I much prefer validating the fields that I really need to have in the save button events.



Richard Rost  @Reply  
           
4 years ago
Yeah, I very rarely use the Required field unless it's something like a required foreign key.
William Farrar OP  @Reply  
    
4 years ago
Thanks for the input...

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: 6/17/2026 12:11:10 PM. PLT: 1s