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

    runtime error 3075

    Code:
    Private Sub Command43_Click()
    'namepo = [Combo1].Value
    Dim strSQL As String
    '
    strSQL = "SELECT Department.Dept_Desc, Count(Source.Headline) AS NumberOfArticles, [Source].Analysis " & _
             "FROM (Clusters INNER JOIN (Department INNER JOIN Cluster_Dept ON Department.Dept_ID=Cluster_Dept.Dept_ID) " & _
             "ON Clusters.Cluster_ID=Cluster_Dept.Cluster_ID) INNER JOIN Source ON Cluster_Dept.ID=Source.ID " & _
             "WHERE (((Source.Analysis)=Forms!ViewReportsForm!Combo53) And ((Source.Day_Month_Year) " & _
             "Between Forms!ViewReportsForm!StartDate And Forms!ViewReportsForm!EndDate)" & _
             "And ((Clusters.Cluster_Desc)=Forms!ViewReportsForm!Combo1)) " & _
             "GROUP BY Department.Dept_Desc, Source.Analysis"
             'If IsNull(Combo1.Value) And IsNull([StartDate]) And IsNull([EndDate]) And IsNull([Search]) And IsNull([Combo53]) Then
                'run report without any condition
               'strSQL = strSQL & ";"
             'Else
    'code:
         'MsgBox strSQL
       
                       If (Combo1.Value <> " ") And (([StartDate] <> " ") Or ([EndDate] <> " ")) And ([Combo53] <> " ") Then
                        strSQL = strSQL & " " & " WHERE Source.Day_Month_Year BETWEEN #" & [StartDate] & "# AND #" & [EndDate] & _
                                "# AND [Clusters].Cluster_Desc= " & [Combo1] & " and " & "[Source].Analysis = " & [Combo53] & ""
                                
                        parSelection = [Combo1] & ";" & "Day_Month_Year:" & [StartDate] & "-" & [EndDate] & [Combo53] & ";"
                       End If
                        Debug.Print strSQL
        'End If
        
    
        
    '   Assign SQL code to query that the entry form uses
                 CurrentDb.QueryDefs("Query1").SQL = strSQL
               
                'Open the report
                DoCmd.OpenReport "Report1", acViewReport
    End Sub
    so i have changed my code from the last post but now i recieve this error...

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Which line of your code is giving you the error?

    J.

  3. #3
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    i have a feeling that it has to be this line of code here:
    Code:
    If (Combo1.Value <> " ") And (([StartDate] <> " ") Or ([EndDate] <> " ")) And ([Combo53] <> " ") Then
                        strSQL = strSQL & " " & " WHERE Source.Day_Month_Year BETWEEN #" & [StartDate] & "# AND #" & [EndDate] & _
                                "# AND [Clusters].Cluster_Desc= " & [Combo1] & " and " & "[Source].Analysis = " & [Combo53] & ""
    

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    it looks like you are double declaring wheres you have one earlier


    "WHERE (((Source.Analysis)=Forms!ViewReportsForm!Combo53) And ((Source.Day_Month_Year) " & _ "Between Forms!ViewReportsForm!StartDate And Forms!ViewReportsForm!EndDate)" & _ "And ((Clusters.Cluster_Desc)=Forms!ViewReportsForm!Com bo1)) "

    then you follow it with a group by, then another where if the offending bit of code executes

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

Similar Threads

  1. RunTime error 3075
    By Compufreak in forum Access
    Replies: 3
    Last Post: 07-25-2012, 02:18 AM
  2. Runtime Error 3075 - Access 2010
    By cwturner2 in forum Programming
    Replies: 5
    Last Post: 06-29-2012, 04:03 PM
  3. Replies: 9
    Last Post: 06-08-2012, 07:11 PM
  4. RunTime Error 3075, code for search button
    By jacie in forum Programming
    Replies: 1
    Last Post: 04-15-2011, 05:23 AM
  5. Runtime 3075 error
    By whm1 in forum Programming
    Replies: 4
    Last Post: 03-24-2010, 02:50 PM

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