Stop entering data if a specific field is Null

J

jean

Hi

I have a table where there is one field named "Apartment"

I have put required Yes for this field.

Here is the problem and I am surelly not the first to ask that.

Right now, user can fill all fields and when he wants to add a new
record, system tells that the "Apartment" field must be entered unless
the record will not be saved.

To add a new record, user have to click a button. When he clicks,
focus goes on the "Apartment" field.

What I want is if user don't fill the "Apartment" field he will not be
able to go to other fields.

Is that possible ?

thanks for helping
 
K

Keith Wilby

jean said:
Hi

I have a table where there is one field named "Apartment"

I have put required Yes for this field.

Here is the problem and I am surelly not the first to ask that.

Right now, user can fill all fields and when he wants to add a new
record, system tells that the "Apartment" field must be entered unless
the record will not be saved.

To add a new record, user have to click a button. When he clicks,
focus goes on the "Apartment" field.

What I want is if user don't fill the "Apartment" field he will not be
able to go to other fields.

Is that possible ?

thanks for helping

I don't think so but, even if you could, what value would it add? In fact,
you might just P off your users by adding that functionality. How about a
modal pop-up form to enter that data instead? The form could be set to
"pop-up" when the "new" button is clicked. Modal property will ensure it
has to be actioned before anything else happens. Just a thought.

Keith.
www.keithwilby.co.uk
 
L

Lynn Trapp

Jean,
You can't do it directly in the table. Instead, you must create a data entry
form that sets the focus to the Apartment field -- if it is null -- in the
Before Update event of your form.
 
J

John Spencer

If your user is entering data into a control bound to the Apartment field you
can use something like the following, but I would not. Your user is LOCKED
into the control until something is filled in, so they will fill in nonsense
values just to exit the control.

Private Sub fText_Exit(Cancel As Integer)
If IsNull(fText_Exit) Then
Cancel = True
MsgBox "Required entry"
End If
End Sub

You could make it a bit more friendly with something along the lines of the
following.

Private Sub fText_Exit(Cancel As Integer)
If IsNull(fText_Exit) Then
If MsgBox("Required entry: Cancel entry?",vbYesNo) = VbYes then
Cancel = false
Me.fText.Undo 'Revert the control to the earlier entry
'Me.Undo 'Revert the record to its original state
else
Cancel = True
End if
End If
End Sub



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
J

james hall

jean said:
Hi

I have a table where there is one field named "Apartment"

I have put required Yes for this field.

Here is the problem and I am surelly not the first to ask that.

Right now, user can fill all fields and when he wants to add a new
record, system tells that the "Apartment" field must be entered unless
the record will not be saved.

To add a new record, user have to click a button. When he clicks,
focus goes on the "Apartment" field.

What I want is if user don't fill the "Apartment" field he will not be
able to go to other fields.

Is that possible ?

thanks for helping
 

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