Access Error "To many fields defined" when exporte

dforgacs

Board Regular
Joined
Jul 16, 2004
Messages
108
I'm attaching my code that exports the results of a query to excel.
I get an error of "To many fields defined" when I run this code.
I first thought it was a query problem and repaired and compacted Database but
that didn't help. On further investigation it was failing during the export to
excel. Let me know if you need more information. Help!
Thanks!
Dan

On Error GoTo cmdExportReport_Click_Err

DoCmd.TransferSpreadsheet acExport, 8, "RepairOpsBestPractices",
"R:\fcsd\SLTS Extract Database\OutputFiles\RepairOpsBestPracticesReport.xls",
True, ""
DoCmd.Close acForm, "frmElmStpsBestPractices"
Beep
MsgBox "The Repair Operation Best Practices Report has been exported into
Excel. Please go to your specified path to view to report. Thank you!",
vbOKOnly, ""

cmdExportReport_Click_Exit:
Exit Sub

cmdExportReport_Click_Err:
MsgBox Error$
Resume cmdExportReport_Click_Exit
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How many fields are there in the query? Access has a query field limit of 255 -- see link -- so, if you exceed that, the routine will fail.

Denis
 
Upvote 0
Hi
Have you tried deleting the target spreadsheet and re-running your code?
Andrew
 
Upvote 0
Access Error "To many fields defined"

Fields checked to show is 7, total in query is less than 20

I Deleted the target file and that fixed it! The error didn't come up and the file has the data in it. Thanks so much!
Daniel Forgacs
 
Upvote 0

Forum statistics

Threads
1,218,753
Messages
6,144,288
Members
450,535
Latest member
Erlull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top