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

    hi guys i am gettin an error called Runtime error 3075

    here is my code:

    Private Sub Command0_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 IsNull(Combo1.Value) And IsNull([StartDate]) And IsNull([EndDate]) Then
    'run report without any condition
    strSQL = strSQL & ";"

    Else
    If ((Combo1.Value <> " ") And IsNull([StartDate]) And IsNull([EndDate])) Then
    'run report by category
    strSQL = strSQL & " " & "WHERE [Clusters].Cluster_Desc =" & Chr(34) & [Combo1] & Chr(34) & ";"
    Else
    If IsNull(Combo1.Value) And (([StartDate] <> " ") Or ([EndDate] <> " ")) Then
    'run report by date recieved"
    strSQL = strSQL & " " & "WHERE [Day_Month_Year] Between #" & [StartDate] & "# AND #" & [EndDate] & "#"
    Else
    If (Combo1.Value <> " ") And (([StartDate] <> " ") Or ([EndDate] <> " ")) Then
    strSQL = strSQL & " " & "WHERE Source.Day_Month_Year #" & [StartDate] & "# AND #" & [EndDate] & "# AND [Clusters].Cluster_Desc =" & Chr(34) & [Combo1] & Chr(34) & ";"
    parSelection = [Combo1] & ";" & "Day_Month_Year:" & [StartDate] & "-" & [EndDate]
    End If
    End If
    End If
    End If

    ' Assign SQL code to query that the entry form uses
    CurrentDb.QueryDefs("Search_by_Clusters and date").SQL = strSQL
    Code:
    MsgBox strSQL
    'Open the report
    DoCmd.OpenReport "Search_by_Clusters and date", acViewReport
    End Sub

    the part i have highlighted is where i am getting the error

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    You're missing the Keyword "Between" on the highlighted line.

    Code:
    strSQL = strSQL & " WHERE Source.Day_Month_Year Between #" & [StartDate] & "# AND #" & [EndDate] & "# AND [Clusters].Cluster_Desc =" & Chr(34) & [Combo1] & Chr(34) & ";"

  3. #3
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    thanks Rawb , i am not sure how i took that out. it works perfectly now

  4. #4
    uronmapu is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2012
    Posts
    124
    The same my problem below?

    https://www.accessforums.net/access/...ing-26792.html

    Please help

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

Similar Threads

  1. Runtime Error 3075 - Access 2010
    By cwturner2 in forum Programming
    Replies: 5
    Last Post: 06-29-2012, 04:03 PM
  2. Replies: 9
    Last Post: 06-08-2012, 07:11 PM
  3. Replies: 6
    Last Post: 05-30-2012, 12:32 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