• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 28
  • Last Modified:

Run-time error 3075

strQuery = "SELECT qryRptData.custnum, qryRptData.Cusname, qryRptData.1, qryRptData.2, " & _
             "qryRptData.3, qryRptData.4, qryRptData.5, qryRptData.6, qryRptData.RecDays, qryRptData.DelDays, " & _
             "qryRptData.amnum, qryRptData.amname, qryRptData.SGMGR, qryRptData.SGNAM, qryRptData.email FROM qryRptData WHERE qryRptData.amnum = '" & manum & "';"

CurrentDb.QueryDefs("Query12").SQL = strQuery

When this is passed is throws Run-time error '3075:
0
Tom Bishop
Asked:
Tom Bishop
1 Solution
 
Dale FyeCommented:
Is this Access?  Access does not generally like columns with names which start with numbers.  Generally you need to wrap those with brackets:

strQuery = "SELECT qryRptData.custnum, qryRptData.Cusname, qryRptData.[1], qryRptData.[2], " _
         & "qryRptData.[3], qryRptData.[4], qryRptData.[5], qryRptData.[6], qryRptData.RecDays, qryRptData.DelDays, " _
         & "qryRptData.amnum, qryRptData.amname, qryRptData.SGMGR, qryRptData.SGNAM, qryRptData.email " _
         & "FROM qryRptData WHERE qryRptData.amnum = '" & manum & "';"

Open in new window


But I would follow this with:

debug.print strQuery
and would put a break point on the line that sets the sql property of the query to that value.  This way, you can copy the value from the immediate window, paste it into a query and try to run it, if the syntax is wrong, it will tell you what is wrong.
1
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Is qryRptData.amnum a Numeric field, or Text?

If it's Numeric, remove the single quotes around your variable.

Also, be sure your variable contains a value.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now