Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box - Must Enter All Data

Status
Not open for further replies.

tpearo

Technical User
Apr 24, 2000
124
US
I have a form where there are several fields that require data. Sometimes the techician forgets to enter data in a certain field. Is there a way that if the technician forgets and trys to close the form a message box can be displayed saying something like "ALL DATA MUST BE ENTERED BEFORE CLOSING FORM" or even better is there someway to indicate which field they failed to enter the data in and make the cursor go back to that particular field.

Any help is appreciated.

Tp
 
A common way is to enforce ALL the validation rules in the BeforeUpdate event of the (bound) form and to play with the SetFocus method and the Cancel argument.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I'm not sure exactly how you do this. Can you explain?
I have a button on the form to close the form. Is there a way to prohibit closing the form until all the data is filled out in the "Required" fields?

Thanks in advance for your help.

Tp
 
i think phv is suggesting that you write code in the before_update event of the form. you can check whether the appropriate fields have the right value in them, if they don't, provide some message to the user and then set the focus on the field in question.
do you have a button that closes the form?
if you use a button, you could always check those required fields in the button's click code, but that doesn't guarantee they won't 'x' out of the window (unless you have disabled that).
 
Another method would be to set the ValidationRule and ValidationText properties for all the "required fields". Set the ValidationRule to something like:

<> "" AND Not Null

and set ValidationText to

ALL DATA MUST BE ENTERED BEFORE CLOSING FORM

 
try thread702-1118481

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top