Applying a Condition to a Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
Rosemary said:
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.


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
 
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 think you now want to use:

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

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

Back
Top