Results 1 to 9 of 9
  1. #1
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70

    run-time error 13 , type mismatch

    hi everyone



    i am getting the following error , please help




    Code:
    
    strSQL = strSQL & "WHERE (((Source.Headline) Like  " * " &  Chr(34) & [Text0].value & Chr(34) & " * " );"

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try this debugging technique and I think you'll see what's going on.

    http://www.baldyweb.com/ImmediateWindow.htm

    I see a couple of problems.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    i have made some changes to mty code , but it is just giving me the following error :
    Code:
    Private Sub Command2_Click()
    Dim strSQL As String
        strSQL = "SELECT Cluster_Dept.ID, Cluster_Dept.Cluster_ID, Cluster_Dept.Dept_ID, Clusters.Cluster_Desc, Department.Dept_Desc, " & _
                "Source.Day_Month_Year, Source.Original_Source, Source.Headline, Source.Issue, Source.Analysis, Source.Action " & _
                "FROM Source INNER JOIN (Department INNER JOIN (Clusters INNER JOIN Cluster_Dept ON Clusters.Cluster_ID " & _
                "= Cluster_Dept.Cluster_ID) ON Department.Dept_ID = Cluster_Dept.Dept_ID) ON Source.ID = Cluster_Dept.ID "
               
                If (([Text0] <> " ")) Then
                    strSQL = strSQL & " " & "WHERE [Source].Headline = " Like "*" & Chr(34) & [Text0] & "*" & ";"
                End If
    'code:
    'MsgBox strSQL
                    '   Assign SQL code to query that the entry form uses
                 CurrentDb.QueryDefs("Search_by_Clusters and date").SQL = strSQL
                 
                'Open the report
                DoCmd.OpenReport "Search_by_Clusters and date", acViewReport
    End Sub
    the part thats bold and underlined is where i am getting an error saying that invalid Sql statement

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    So you haven't tried what I suggested? Why not just use a parameter query?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    hi i have just solved the issue , simple solution really . but if you have any time on your hands , i would like to know if it possible to create an "all" feature . so far i have created a positive, negative and neutral feature. now i would like to know if it is possible to create an "all" feature .

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Might help if you post the code that does the others, but in general to get all you'd just leave that field out of the WHERE clause.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    i have sorted this error out , thanks again for your help it is truly appreciated

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help. It could help future users if you posted the working solution.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    sure i don't mind at all, here is the solution...

    Code:
    If (([Search] <> " ")) Then
                            strSQL = strSQL & " " & "WHERE Source.Headline Like" & Chr(34) & "*" & [Search] & "*" & Chr(34)

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

Similar Threads

  1. run-time error '13' type mismatch
    By teebumble in forum Forms
    Replies: 8
    Last Post: 12-03-2012, 01:18 PM
  2. Run-time error '13': Type mismatch
    By uronmapu in forum Access
    Replies: 2
    Last Post: 07-10-2012, 07:59 PM
  3. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  4. Error#13 Type Mismatch
    By Nistin27 in forum Access
    Replies: 8
    Last Post: 08-17-2011, 04:15 PM
  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