Run-time error '3125'

I am using the following code to export data from an MS Access db to Excel:

DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_ABS", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_PriorYear_ABS", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_Eqty", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_PriorYear_Eqty", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_LTDbt", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_PriorYear_LTDbt", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_STDbt", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_PriorYear_STDbt", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
    Call Shell("""C:\Program Files\Microsoft Office\Office10\EXCEL.EXE"" ""J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", 1)

When I run the code I receive the following error "Run-time error '3125'. It is odd to me since I am using the same exact code in various other MS Access db's that I have created without any issues. I have the db set to compact and repair upon closing, and have created a new mdb file and imported all objects and still receive the same error. Any assistance or thoughts would be very helpful. I am finishing up this project on my current assignment and need to finish by this Friday.
pmjg23Asked:
Who is Participating?
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.

frankyteeCommented:
have you set a breakpoint to see where the code fails? which line does it occur?

check that all the queries exists and try removing the last argument as it relates to an xl range which is usually used for import not export.
ie
change
DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_ABS", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True, ""
to
DoCmd.TransferSpreadsheet acExport, 8, "qryRpt_Cntry_CurrentYear_ABS", "J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\rptCountry_Securities1.xls", True
pmjg23Author Commented:
Hi frankytee,

It occurs for all lines of code, and have already checked naming conventions for queries. Will try what you suggested for fix and will let you know results. Thanks
wsh2Commented:
J:\REG REP\JPMREPORT\Treasury Surveys\Database\Excel\

Is the J: drive mapped to this computer?

Do you have write permissions to "REG REP\JPMREPORT\Treasury Surveys\Database\Excel\" ?

Is the read-only attribute on for the spreadsheet file?
Get a highly available system for cyber protection

The Acronis SDI Appliance is a new plug-n-play solution with pre-configured Acronis Software-Defined Infrastructure software that gives service providers and enterprises ready access to a fault-tolerant system, which combines universal storage and high-performance virtualization.

pmjg23Author Commented:
Hi frankytee,
What you suggested did not work. Do you have any other suggestions relating specifically to the error? "Run-time error '3125': "is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long."

I have tested by changing the name of the queries to "qrytest" and I still receive the error?
pmjg23Author Commented:
I found the solution, I needed to minimize some of the field names in the main table, since when exporting data into excel if within the query the joins go over a certain total it will produce that error.
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin

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
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.