Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Help with Blank, Null, and Zero length entries in forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DominicGreco - 28 May 2008 18:18 GMT
I want to make it so that the user is required to fill in each text/combo/or
list box on the form before moving to the next.

I figure this is pretty easy. In the Table properties, I set the "Required"
property to YES and the Allow Zero length to NO. In the control's property
box I set the Validation Rule to "<> = Null" or IS NOT NULL.

So I can't have a zero length entry, and I can't have a Null one.

HOWEVER, when I start the form the first Combobox I must fill is the Employee
Name. If I "TAB" over it, and input info into the next combobox, it WORKS! I
can even save the record!

Now I know for a fact that the "<> = Null" works because if I try to put a
"SPACE" in (using the space bar) and then tab to the next combo box, I get a
msgbox with my Validation text in it.

What am I missing here?
Ken Snell (MVP) - 28 May 2008 18:52 GMT
Validation rules, etc. are triggered by an entry or deletion in the control,
not by just tabbing past the control. You'd need to use code for the Exit
event to not allow the user to leave the control without typing in a value
or selecting a value (NOTE:  Users can get very impatient with a form that
enforces this on the Exit event -- and users are then known to crash ACCESS
in order to get out of the loop -- note also that this code can prevent you
from cancelling the form without entering a value) --

Or, even better, to use the form's BeforeUpdate event to test that each
control has a value in it.

Signature

       Ken Snell
<MS ACCESS MVP>

>I want to make it so that the user is required to fill in each
>text/combo/or
[quoted text clipped - 19 lines]
>
> What am I missing here?
John W. Vinson - 29 May 2008 05:52 GMT
>I want to make it so that the user is required to fill in each text/combo/or
>list box on the form before moving to the next.

Well... that really goes against the whole Windows philosophy of using
interactive forms.

Is it in fact really critical that the controls must be entered *in a specific
order*? Or don't you actually just need them to all be entered before the
record is saved?

You can do the latter easily by checking for non-Null values in all controls
in the Form's BeforeUpdate event, and setting Cancel to true with a MsgBox
warning if they've left something blank.
Signature


            John W. Vinson [MVP]

DominicGreco - 29 May 2008 15:35 GMT
>Well... that really goes against the whole Windows philosophy of using
>interactive forms.

I realize that. But this is a timesheet program and I need to structure it
along predictated lines (not mine)

>You can do the latter easily by checking for non-Null values in all controls
>in the Form's BeforeUpdate event, and setting Cancel to true with a MsgBox
>warning if they've left something blank.

This was pretty much the way I have been proceeding. I was using the Form's
BeforeUpdate Event to house a small VB App that would check for Null or blank
entries. However, this is a blanket program which checks ALL the controls.
Even the ones I don't want checked. And it causes an error. Therefore I was
going to try a more "focused" approach by structing an IF statement using the
actual name of the control(s) I need to check.

Your thoughts?
John W. Vinson - 29 May 2008 17:13 GMT
>This was pretty much the way I have been proceeding. I was using the Form's
>BeforeUpdate Event to house a small VB App that would check for Null or blank
>entries. However, this is a blanket program which checks ALL the controls.
>Even the ones I don't want checked. And it causes an error. Therefore I was
>going to try a more "focused" approach by structing an IF statement using the
>actual name of the control(s) I need to check.

One way to do this is to use the controls' Tag property. For instance you
could set the Tag property to be "NonNull" (or to contain that string) for
each control which is required; you can then loop through the form's Controls
collection and only check those controls with "NonNull" in the Tag property
(before checking the control's Value, since many kinds of controls don't have
a Value).
Signature


            John W. Vinson [MVP]

David W. Fenton - 30 May 2008 00:47 GMT
>>Well... that really goes against the whole Windows philosophy of
>>using interactive forms.
>
> I realize that. But this is a timesheet program and I need to
> structure it along predictated lines (not mine)

Then use a wizard type interface. This can be done easily with a tab
control with the tabs hidden. You'd enable the NEXT>> button only
when the fields on that tab page have been properly filled out.

Signature

David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.