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 Programming / May 2005

Tip: Looking for answers? Try searching our database.

Applying a Condition to a Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rosemary - 03 May 2005 03:47 GMT
Hello,

I have a field that was once a required field.  I eventually decided not to
make it required (to make a long story short).  This is what I would like to
do instead:

We have a checkbox on our Main form labelled "Completed".  We check this
checkbox when a job has been completed, to release it from the work to be
done list.

I'd like to code the onClick event of the Completed checkbox so that a field
on my Documents subform, called "Document number", is looked at.  If the
value of the Document Number field is null, a warning message should pop up
saying "Document number cannot be left blank".  Once this field is filled in
(or if it's already filled in), the user is then allowed to check the
Completed checkbox.

How would for this be written?

Many thanks,
Marshall Barton - 03 May 2005 04:21 GMT
>I have a field that was once a required field.  I eventually decided not to
>make it required (to make a long story short).  This is what I would like to
[quoted text clipped - 10 lines]
>(or if it's already filled in), the user is then allowed to check the
>Completed checkbox.

Use the check box's AfterUpdate event

If Me.chkCompleted = True Then
    If IsNull(Me.subformcontrol.Form.DocumentNum) Then
        MsgBox "Document number cannot be left blank"
        Me.chkCompleted.Undo
    End If
End If

Signature

Marsh
MVP [MS Access]

Rosemary - 04 May 2005 12:50 GMT
Thanks Marshall,

That works, thanks.  However, I now want to modify the code to place it in
the AfterUpdate event of a Date/Time field, instead of the checkbox field.  I
would no longer use "True", correct?  How would I write . . .

If Me.DateTimeEnded = ??? Then

Thanks!

> >I have a field that was once a required field.  I eventually decided not to
> >make it required (to make a long story short).  This is what I would like to
[quoted text clipped - 19 lines]
>     End If
> End If
Marshall Barton - 04 May 2005 13:51 GMT
I think you now want to use:

If Not IsNull(Me.DateTimeEnded) Then
    , , ,
Signature

Marsh
MVP [MS Access]

>That works, thanks.  However, I now want to modify the code to place it in
>the AfterUpdate event of a Date/Time field, instead of the checkbox field.  I
[quoted text clipped - 25 lines]
>>     End If
>> End If
 
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.