Hi,
I've tried to reverse engineer the "Pine" example of manipulating the filter arguement for a subform using multiple comboboxes, but have failed. "13 - Type Missmatch Error". i also tried the earlier method of manipulating the recordsource but if i chose more then one combo box to filter by i got a "FROM arguement syntax" error...
My subform is based on a query... please have a look at the code below and tell me wher i've boo boo'd, or does anyone have an idiots guide to this?
Thanks for any help, Rob
I've tried to reverse engineer the "Pine" example of manipulating the filter arguement for a subform using multiple comboboxes, but have failed. "13 - Type Missmatch Error". i also tried the earlier method of manipulating the recordsource but if i chose more then one combo box to filter by i got a "FROM arguement syntax" error...
My subform is based on a query... please have a look at the code below and tell me wher i've boo boo'd, or does anyone have an idiots guide to this?
Thanks for any help, Rob
Private Function SCARsearch()
On Error GoTo Error_SCARsearch
Dim FilterClause As String
'1st Combo - SCAR
If Len(Me.cbo_SCAR.Value) > 0 Then
If FilterClause <> "" Then FilterClause = FilterClause & "AND"
FilterClause = FilterClause & "[SCAR_ID]='" & Me.cbo_SCAR.Value & "'"
End If
'2nd Combo - Engineer
If Len(Me.cbo_Engineer.Value) > 0 Then
If FilterClause <> "" Then FilterClause = FilterClause & "AND"
FilterClause = FilterClause & "[Engineer_ID]='" & Me.cbo_Engineer.Value & "'"
End If
'3rd Combo - Supplier
If Len(Me.cbo_Supplier.Value) > 0 Then
If FilterClause <> "" Then FilterClause = FilterClause & "AND"
FilterClause = FilterClause & "[Supplier_number]='" & Me.cbo_Supplier.Value & "'"
End If
'Place our created Filter Criteria into the Filter property of SubForm.
Forms(frm_close_scars)(sfrm_close_scar).Form.Filter = FilterClause
'Turn on the Filter
Forms(frm_close_scars)(sfrm_close_scar).Form.FilterOn = True
Exit_SCARsearch:
Exit Function
Error_SCARsearch:
MsgBox "SCARsearch Function Error" & vbCr & vbCr & _
Err.Number & " - " & Err.Description, vbExclamation, _
"SCAR Search Error"
Resume Exit_SCARsearch
End Function