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.
' 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.