Results 1 to 6 of 6
  1. #1
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82

    Type Mismatch error... Please help...

    Hi all



    Can anyone tell me why I get an error message when trying to run this code? I get a "Type Mismatch"??

    Both Ref and Day are TEXT

    Code:
    Private Sub Ref_DblClick(Cancel As Integer)
        Dim sWhere As String
        
        sWhere = "[Ref] = '" & Me.Ref & "'" And "[Day] = '" & Me.Day & "'"
        
        DoCmd.OpenForm "frmChecklistSingle", , , sWhere
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,207
    The double quotes on both sides of And need to be removed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82
    Can you be more specific?? I tried removing a number of the quotes but still had no luck??

    Thanks

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,207
    Take out the ones in red. The ones on both sides of And.

    sWhere = "[Ref] = '" & Me.Ref & "'" And "[Day] = '" & Me.Day & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82
    Perfect Thanks!!!!

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,207
    No problem!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error 13 Type Mismatch
    By jj1 in forum Access
    Replies: 5
    Last Post: 05-21-2014, 12:33 PM
  2. Type mismatch error
    By broodmdh in forum Programming
    Replies: 3
    Last Post: 08-29-2013, 05:56 AM
  3. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  4. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  5. type mismatch error?
    By hlcarlin in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 08:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums