C
Cam
Hello,
I have a form with Multiple fields filter based on and event procedure where
I can filter multiple combo fields. I would like to print a report after the
filtered fields, but not sure how to like what is the control source etc..
Any help is appreciated.
Here is my sample form filter event procedure.
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.cboMach) Then
strWhere = strWhere & "([Mach] = '" & Me.cboMach & "') AND "
End If
If Not IsNull(Me.cboOrd) Then
strWhere = strWhere & "([Ord] = '" & Me.cboOrd & "') AND "
End If
If Not IsNull(Me.cboWC) Then
strWhere = strWhere & "([WC] = '" & Me.cboWC & "') AND "
End If
If Not IsNull(Me.cboPart) Then
strWhere = strWhere & "([Part] = '" & Me.cboPart & "') AND "
End If
If Not IsNull(Me.cboShift) Then
strWhere = strWhere & "([Shift] = " & Me.cboShift & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
I have a form with Multiple fields filter based on and event procedure where
I can filter multiple combo fields. I would like to print a report after the
filtered fields, but not sure how to like what is the control source etc..
Any help is appreciated.
Here is my sample form filter event procedure.
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.cboMach) Then
strWhere = strWhere & "([Mach] = '" & Me.cboMach & "') AND "
End If
If Not IsNull(Me.cboOrd) Then
strWhere = strWhere & "([Ord] = '" & Me.cboOrd & "') AND "
End If
If Not IsNull(Me.cboWC) Then
strWhere = strWhere & "([WC] = '" & Me.cboWC & "') AND "
End If
If Not IsNull(Me.cboPart) Then
strWhere = strWhere & "([Part] = '" & Me.cboPart & "') AND "
End If
If Not IsNull(Me.cboShift) Then
strWhere = strWhere & "([Shift] = " & Me.cboShift & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub