Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using If Then with Check Box 1

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
Hi,

I'm trying to display a message if the user does not click on a couple of check boxes.

If Me.chBox1.Value = Null And Me.ckPTPRDDTAASI.Value = Null Then
MsgBox "You must a Check Box."
End
End If

However, the code ignores the If Then clause and keeps on going?

Any ideas what I'm forgetting to do?

Thank you!
 
If Not (Me!chBox1 Or Me!ckPTPRDDTAASI) Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you PHV... but it still didn't work. Any thoughts?
 
If the checkboxes are in an option group then check the value of the frame.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV, the checkboxes are not in an option group. Could it be anything else?
 
Perhaps this ?
If Not (Nz(Me!chBox1, False) Or Nz(Me!ckPTPRDDTAASI, False)) Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Code:
If Me.chBox1.Value = Null And Me.ckPTPRDDTAASI.Value = Null Then
    MsgBox "You must a Check Box."
    [highlight]End[/highlight]    
End If

Why End???????
 
PHV, That worked OK. Thank you! Could you explain why this approach finally worked?

ItIsHardToProgram - I guess you are correct. No need for End.

Thank you both!
 
Any expression containing a Null can't evaluate to True, thus the use of the Nz function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you PHV for all your help and explanation!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top