Code: Select all
SELECT tblInspectionInfo.InspectionID, tblInspectionInfo.SupplierID, tblInspectionInfo.TubeSerialID, tblInspectionInfo.InspectionTypeID, tblInspectionInfo.OtherDescription, tblInspectionInfo.DataSubmitBy, tblInspectionInfo.DataSubmitDate, tblInspectionInfo.DataReviewBy, tblInspectionInfo.DataReviewDate, tblInspectionInfo.DataCheckBy, tblInspectionInfo.DataCheckDate, tblInspectionInfo.AnalysisCompleteBy, tblInspectionInfo.AnalysisCompleteDate, tblInspectionInfo.AnalysisCheckBy, tblInspectionInfo.AnalysisCheckDate, tblInspectionInfo.Status135, tblInspectionInfo.Status225, tblInspectionInfo.Status315, tblInspectionInfo.DataMoved, tblInspectionInfo.InspectionNotes
FROM tblInspectionInfo
WHERE (((tblInspectionInfo.SupplierID) Is Not Null) AND ((tblInspectionInfo.TubeSerialID) Is Not Null) AND ((tblInspectionInfo.InspectionTypeID) Is Not Null));
Code: Select all
Private Sub cmdRunReport_Click()
'tells database how to filter (or not filter) the report to display the desired inspection data
Dim strWhere As String
On Error GoTo ErrHandler
If Not IsNull(Me.cmbSupplier) Then
strWhere = " AND SupplierID='" & Me.cmbSupplier & "'"
End If
If Not IsNull(Me.cmbTubeSerial) Then
strWhere = strWhere & " AND TubeSerialID='" & Me.cmbTubeSerial & "'"
End If
If Not IsNull(Me.cmbInspectionType) Then
strWhere = strWhere & " AND InspectionTypeID='" & Me.cmbInspectionType & "'"
End If
If Not IsNull(Me.cmbAcceptability) Then
strWhere = strWhere & " AND Status135='" & Me.cmbAcceptability & "'" & " AND Status225='" & Me.cmbAcceptability & "' AND Status315='" & Me.cmbAcceptability & "'"
End If
If strWhere <> "" Then
strWhere = Mid(strWhere, 6)
End If
DoCmd.OpenReport "rptAllInspections", View:=acViewPreview, WhereCondition:=strWhere
Me.Visible = False
Exit Sub
ErrHandler:
If Err <> 2501 Then
MsgBox Err.Description, vbExclamation
End If
End Sub