Required Fields NOT being Filled in

Randomblink

The Irreverent Reverend
Local time
Today, 04:02
Joined
Jul 23, 2001
Messages
279
Ok...
So I have a form where the user input data...
The fields that are REQUIRED (from the underlying table) are NOT geetting filled in... Due to system / coding constraints, I have a close button that saves everything...

Since I have multiple forms just like this one, just for different tables / data, I need a solution that will work from a public function... Can someone help me...?
 
Instead of 'requiring' each field to be filled at the table level mark each required field with an "X" in the tag property of each form field. You can then build a public function which loops through each field and returns an error if the field is empty.

A search on this forum for "loop tag property" brought up the code (requiring a little tweaking obviously).
 
ALWAYS use declarative RI when it is available to you. If the fields are required, set them as required at the table level. You don't say what your problem is. Are the "bad" records being saved or are you getting errors that you don't want to see. What do you want to happen when you press the close button if any required fields are not filled in?
 
What is happening...

Well, I fill in one or two fields, when I have like 4 that are required at the table level, and when I close, part of my Form Closing script runs DoCmd.Save acCmdSaveRecord

So it is saving it, when it should be saying, Uh...

You didn't fill in, this and this and this...
See part of the problem is I am using a custom built button function to handle all my button functions, so it has to be rather generic. If you can help Pat, that would be great... If not, I completely understand...
 
If you truely had the fields defined as required at the table level, Jet would NEVER allow the record to be saved with those fields missing. The form may be closing, but the "bad" record is not being saved. If a "bad" record is being saved, it is because the required properties are not set as you think they are. Also, check the default values. If you have specified defaults, Jet will use those.
 

Users who are viewing this thread

Back
Top Bottom