Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012
    Location
    Middle Georgia
    Posts
    11

    Unanswered: Runtime Error 13 - Type Mismatch

    I have a form with multiple filters in which I can select either filter or both. When I select either filter, the filter works fine. When I select both, I get a runtime Error 13 - Type Mismatch. All I did was combine the two filters into one. The error is on the blue line. I don't see anything that looks wacky, but I'm not the expert. Thanks.

    Code:
    Private Sub btnFilter_Click()
    
    If Me.totalcount = 1 Then
        Master.Form.Filter = "[" & Me.cboSrchField1 & "] = '" & Me.cbofilterfld1 & "'"
        Master.Form.FilterOn = True
    ElseIf Me.totalcount = 2 Then
        Master.Form.Filter = "[" & Me.cboSrchField2 & "] like '*" & Me.txtfilterfld2 & "*'"
        Master.Form.FilterOn = True
    ElseIf Me.totalcount = 3 And Me.cboAND = "AND" Then
        Master.Form.Filter = "([" & Me.cboSrchField1 & "] = '" & Me.cbofilterfld1 & "') & " And " & ([" & Me.cboSrchField2 & "] like '*" & Me.txtfilterfld2 & "*')"
        Master.Form.FilterOn = True
    End If
    
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    If the two component parts work separately and when combined dont then its down to how you joined those two parts together.

    The very fact you have inttoduced brackets proves you haven't just combined whatvwas working.


    Id suggest you go through your code paying special attention to where you drop in or out of literal text (ie text that is supplied as is and code that is replaced at run time.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2012
    Location
    Middle Georgia
    Posts
    11
    The brackets were already there. I put in parentheses when I combined them, but took them out to see if that caused the problem. The error still occurs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •