compulsary field

G

Guest

Hi all, i have a combo box on a form that needs to have a name entered from
the drop down list that is already there. Currently i can simply tab through
this field without entering a value. The form has several fields that are
filled in and then a close form button is pressed which saves the form. The
form is filled in by tabbing through the fields or selecting the fields in
any order with the mouse.
I need an error message "Please enter engineer" to pop up if this field has
been tabbed through with out entry or simply been ignored.
I thought i could simply just have this as a reuired field in my table but
this does not seem to work.
Any help appreciated.
 
A

Al Campagna

Maax,
In your table design, make that field Required. You mat still be able to tab through
it, but you will not be able to save the record until an entry has been made.
This will work wheteher the user enters the Engineer field or not...

If you want to "force" a message when just tabbing through the field, then use the
OnExit event of that field to trigger this code.
Private Sub Engineer_Exit(Cancel as Integer)
IF IsNull([Engineer]) Then
MsgBox "Must Enter an Engineer"
Cancel = True
End if
Once you tab into Engineer, you will not be allowed to leave that field without an
entry.
This will only work if the Engineer control is entered via tabbing or mouse.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
G

Guest

Hi Al,


Al Campagna said:
Maax,
In your table design, make that field Required. You mat still be able to tab through
it, but you will not be able to save the record until an entry has been made.
This will work wheteher the user enters the Engineer field or not...

If you want to "force" a message when just tabbing through the field, then use the
OnExit event of that field to trigger this code.
Private Sub Engineer_Exit(Cancel as Integer)
IF IsNull([Engineer]) Then
MsgBox "Must Enter an Engineer"
Cancel = True
End if
Once you tab into Engineer, you will not be allowed to leave that field without an
entry.
This will only work if the Engineer control is entered via tabbing or mouse.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Maax said:
Hi all, i have a combo box on a form that needs to have a name entered from
the drop down list that is already there. Currently i can simply tab through
this field without entering a value. The form has several fields that are
filled in and then a close form button is pressed which saves the form. The
form is filled in by tabbing through the fields or selecting the fields in
any order with the mouse.
I need an error message "Please enter engineer" to pop up if this field has
been tabbed through with out entry or simply been ignored.
I thought i could simply just have this as a reuired field in my table but
this does not seem to work.
Any help appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top