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, FROM qryRptData WHERE qryRptData.amnum = '" & manum & "';"

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

When this is passed is throws Run-time error '3075:
Tom BishopAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
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, " _
         & "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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.