ok. This is what my code looks like now:
Code:
Dim strSQL As String, intCounter As Integer, strWhere As String
Dim db As Database, rs As Recordset
Dim ctl As Control, strname As String, strnewquery As String
Dim strRptSel As String
Dim stMessage As String
Set db = CurrentDb
'Build SQL String
For Each ctl In Me.Form
If ctl.Tag = "input" Then
strname = "me." & ctl.Name
If ctl.Value > "" Then
strSQL = strSQL & "[" & ctl.Name & "] " & " like " & Chr(34) & ctl.Value & Chr(34) & " And "
End If
End If
Next ctl
' Set the value of the parameter.
If Me.cboWEdateFrom & vbNullString <> "" And Me.cboWEdateTo & vbNullString <> "" Then
strSQL = strSQL & ("[inQADateStamp] BETWEEN #" & cboWEdateFrom & "# And #" & cboWEdateTo & "# And " & "'")
End If
If Me.Priority = -1 Then
strWhere = strWhere & "([QA Priority Bin] = True) AND "
ElseIf Me.Priority = 0 Then
strWhere = strWhere & "([QA Priority Bin] = False) AND "
End If
strnewquery = "Select qryQAReport.* FROM qryQAReport"
If strSQL <> "" Then
strSQL = Left(strSQL, (Len(strSQL) - 5))
strnewquery = strnewquery & " WHERE " & strSQL & ";"
End If
Debug.Print strnewquery
' Create the recordset
Set rs = db.OpenRecordset(strnewquery)
If rs.RecordCount > 0 Then
DoCmd.OpenReport "rptQAReport", acViewPreview, , strSQL
' DoCmd.OutputTo acOutputReport, "rptQAReport", acFormatXLS, True
' DoCmd.Close acForm, "frmReportbuilder"
Else
MsgBox "There are no records that match your criteria! Please select new criteria.", vbInformation
Exit Sub
End If
Still only returns no when i select yes???