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 / June 2006

Tip: Looking for answers? Try searching our database.

Control Validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Confused Slug - 30 Jun 2006 13:05 GMT
What is the best expression to use in the Validate property for a control to
test that some text (of unconstrained length) has been entered.
Allen Browne - 30 Jun 2006 13:54 GMT
Open the table in design view, and set the field's Required property to Yes.

If you prefer to use the Validation Rule of the field in the table:
   Is Not Null

If you want to do it in a form, use the BeforeUpdate event of the form to
test it the control IsNull(). You cannot merely use the Validation Rule of
the control, since that is not triggered if nothing is entered.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> What is the best expression to use in the Validate property for a control
> to
> test that some text (of unconstrained length) has been entered.
Confused Slug - 30 Jun 2006 14:17 GMT
I am currently using the the following code in the beforeupdate event,

Private Sub DESCRIPTION_22_BeforeUpdate(Cancel As Integer)

   If IsNull(DESCRIPTION_22) = True Then
       MsgBox "Enter text"
   Cancel = True

End If

End Sub

I have found that the validation does not take place until the field has had
a value in it. When a new record is created i find that you can tab out of
the control without entering any text. Only when text has been added and  
deleted does the validation event occur.

> Open the table in design view, and set the field's Required property to Yes.
>
[quoted text clipped - 8 lines]
> > to
> > test that some text (of unconstrained length) has been entered.
Allen Browne - 30 Jun 2006 15:49 GMT
Yep: exactly what we said.
The events of the control won't work.

Use the *form's* BeforeUpdate event (not the control's event), or the field
properties in the table.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I am currently using the the following code in the beforeupdate event,
>
[quoted text clipped - 29 lines]
>> > to
>> > test that some text (of unconstrained length) has been entered.
 
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.