Msg box if Null

  • Thread starter Thread starter Linda RQ
  • Start date Start date
L

Linda RQ

Hi Everyone,

Using Access 2003. I have a check box on my form. When patients are done
with therapy, this is checked and when it's checked, the patients no longer
show up on the form. I want to create a message that launches and won't
allow the user to continue unless the TherapyEndDate is filled in and the
LocationEndDate is filled in. I am not sure where to start. I assume I'll
have to put rules in each control and in the check box?

If you could just lead me to how to ask this question so the help file knows
what I want, that would be great.

Thanks,
Linda
 
Hi Linda,

If I understand correctly, the form has a checkbox, and if the user checks
the box, you want to verify that the TherapyEndDate and the LocationEndDate
textboxes are filled in, otherwise to disallow the box being checked. If so,
try the below, substituting the actual checkbox control's name and the
message you want users to see:

In the checkbox After Update event:

If Nz(me.LocationEndDate, "") = "" OR Nz(Me.TherapyEndDate,"") = "" Then
MsgBox "You must fill in the appropriate fields before continuing"
me.Checkbox = false
End if
 
Hi Susan,

Thanks for helping. I replaced the field names with the actual names and
pasted the code below. When I clicked Debug/Compile I got the following
error. These fields are on subforms placed on the main form where the
Isolation Checkbox is. I don't really know how to write code but I think I
will probably need to identify the subform names that these two fields are
on?

Compile Error: method or data member not found

Private Sub Isolation_AfterUpdate()
If Nz(Me.PtLocEnDtTm, "") = "" Or Nz(Me.ThpyEndDtTm, "") = "" Then
MsgBox "You must fill in the appropriate fields before continuing"
Me.Isolation = False
End If

End Sub


......Linda
 
Just a comment.

In

Me!YourSubForm.Form.YourControl

"YourSubForm" actually refers to the subform control on the parent form.
Depending on how you added the subform to the parent form, the name of the
control can be different than the name of the form being used as the
subform. It's important that you use the correct name.
 
Excellent point Doug!
Douglas J. Steele said:
Just a comment.

In

Me!YourSubForm.Form.YourControl

"YourSubForm" actually refers to the subform control on the parent form.
Depending on how you added the subform to the parent form, the name of the
control can be different than the name of the form being used as the
subform. It's important that you use the correct name.
 

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

Similar Threads


Back
Top