Close form with required fields empty...

MackMan

Registered User.
Local time
Today, 20:30
Joined
Nov 25, 2014
Messages
174
A simple one I'm obviously missing something...

One form.

Several fields which are required using event 'On exit' - "If isnull" statements for each one.

Button on form to close said form...

Where on the form would I put the event for the button to override all other events?

As always, appreciate your help!:)
 
I'm obviously missing something...

A more detailed overview of what you're trying to do, I think.


One form.

Several fields which are required using event 'On exit' - "If isnull" statements for each one.

Button on form to close said form...

Where on the form would I put the event for the button to override all other events?

So, if I can understand this:

...you have several controls on a form that require information be entered into them. However, if the person clicks a button to close the form, you want to forget that these fields are required and close the form. Is that correct?

ETA: Yes, it is. [Someone (i.e. me) is not quite awake today]
 
Last edited:
Anyway, what code do you have just now?

Or is it the case that your table design has the Required property flagged, and that's your issue?
 
...you have several controls on a form that require information be entered into them. However, if the person clicks a button to close the form, you want to forget that these fields are required and close the form. Is that correct?
Spot on!

That's the one!...

I'm stuck on where to put the buttons code to override the vba on all the other fields.:o

the tables are marked as Not required,

and the codes I'm using for the text boxes are...

Code:
 if isnull (me.fieldname) then
 msgbox "Message here", msgboxtype etc etc
 me.fieldname.setfocus
 cancel=true
 end if
 
Putting checks on a control's OnExit presupposes that the user WILL visit that control. That assumption is not always valid.

The proper data validation is performed at the last stop before data is written to the database, and that is the form's BeforeUpdate
 

Users who are viewing this thread

Back
Top Bottom