Private Sub QA_Report_Click()
On Error GoTo Err_QA_Report_Click
Dim stDocName As String
Dim stWhere As String
Dim stDates As String
Dim blnRepair As Boolean
If Not IsNull(Me.Combo44) Then
stWhere = "[Part]=" & Chr(34) & Me.Combo44 & Chr(34) & " AND "
End If
If Len(Me.Text22 & "") = 0 Then
If Len(Me.Text24 & "") > 0 Then
stWhere = stWhere & "[Cus Order Date] <=#" & [COLOR="Red"]Format([/COLOR]Me.Text24[COLOR="red"],"mm/dd/yyyy")[/COLOR] & "# AND "
End If
Else
If Len(Me.Text24 & "") = 0 Then
If Len(Me.Text22 & "") > 0 Then
stWhere = stWhere & "[Cus Order Date]>=#" & [COLOR="red"]Format([/COLOR]Me.Text22[COLOR="red"],"mm/dd/yyyy")[/COLOR] & "# AND "
End If
Else
If Len(Me.Text22 & "") > 0 And Len(Me.Text24 & "") > 0 Then
stWhere = stWhere & "[Cus Order Date] Between #" & [COLOR="red"]Format([/COLOR]Me.Text22[COLOR="red"],"mm/dd/yyyy")[/COLOR] & "# And #" & [COLOR="red"]Format([/COLOR]Me.Text24[COLOR="red"],"mm/dd/yyyy")[/COLOR] & "# [COLOR="Red"]AND[/COLOR] "
End If
End If
End If
If Me.Repair Then
stWhere = stWhere & "[Repair]= True"
End If
If Right(stWhere, 5) = " AND " Then
stWhere = Left(stWhere, Len(stWhere) - 5)
End If
stDocName = "QA Report"
Debug.Print strWhere
DoCmd.OpenReport stDocName, acViewPreview, , stWhere
Exit_QA_Report_Click:
Exit Sub
Err_QA_Report_Click:
MsgBox Err.Description
Resume Exit_QA_Report_Click
End Sub