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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Check Condition for Checkboxes- True or Yes or What?

Status
Not open for further replies.

rmtiptoes

IS-IT--Management
Mar 30, 2004
55
US
Hi All,

I am trying to print a report based upon the condition that a checkbox is checked in the database. I have tried to
' If CompleteStatus = True' and ' If CompleteStatus = Yes' and neither works. When I put in a message box to display the value, it shows nothing. What If conditiion do I use?


Private Sub Print2_Click()
On Error GoTo Err_Print2_Click

Dim strDocName As String
Dim strWhere2 As String
'Dim strComplete As String

strDocName = "Assets_New"
strWhere = "[Asset ID Number]='" & Me![Asset ID Number] & "'"
strWhere2 = CompleteStatus = Me![CompleteStatus]
MsgBox CompleteStatus
'strComplete = Me![CompleteStatus].Value
If CompleteStatus = True Then
DoCmd.OpenReport strDocName, acPreview, , strWhere2
Else
MsgBox "You have selected to print an asset that is not complete. Please " & _
"review the asset record and check the 'Complete' Status box."
End If

Exit_Print2_Click:
Exit Sub

Err_Print2_Click:
MsgBox Err.Description
Resume Exit_Print2_Click

End Sub



Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.

 
strWhere2 = CompleteStatus = Me![CompleteStatus]
should be:
strWhere2 = "CompleteStatus = " & Me![CompleteStatus]

Obviously you have been trying many things out in this code and there is redundant code now present. You need to look through it carefully now and get back to what it should be doing.
 
Something like this ?
...
strWhere2 = "CompleteStatus = " & Me![CompleteStatus]
MsgBox strWhere2
If Me![CompleteStatus] Then
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Aha!!!!!! That worked and the message box displayed the value I needed to inspect. Thank you sooo much!!!

I also cleaned it up. Sorry for the confusion.

Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top