Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011

    Unanswered: Run Time error 13

    Hello everyone,
    I'm trying to filter my form based on the event start date and every time I try I get run time error 13. The code it highlights is bellow but I'm not sure what is wrong, I am new to access. Any help would be greatly appreciated.Thanks

    This is the part of my code it highlights
    strFilter = strFilter & _
    " AND ([eventdatestart]=" & _
    Format(CDate(Me.FindEventDate), _
    "\#m/d/yyyy\#") & ")"

    This is my whole code:

    Me.FindEventDate = IIf(IsDate(Me.FindEventDate), _
    Format(Me.FindEventDate, "#m/d/yyyy"), _

    Dim strFilter As String, strOldFilter As String

    strOldFilter = Me.Filter
    If Me.FindEventDate > "" Then
    strFilter = strFilter & _
    " AND ([eventdatestart]=" & _
    Format(CDate(Me.FindEventDate), _
    "\#m/d/yyyy\#") & ")"
    End If
    If strFilter > "" Then strFilter = Mid(strFilter, 6)
    If strFilter <> strOldFilter Then
    Me.Filter = strFilter
    Me.FilterOn = (strFilter > "")
    End If

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I distinctly remember answering this yesterday; don't know where my post went!

    Anyway, Access is not noted for accuracy when highlighting errant code. I'm not really sure you need the Hash Mark (#) in

    Format(Me.FindEventDate, "#m/d/yyyy")

    but I real sure that if you use them they have to be used in pairs!

    Format(Me.FindEventDate, "#m/d/yyyy#")

    I suspect having that missing is causing the Type Mismatch error you're getting.

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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