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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
Hi
Have you tried deleting the target spreadsheet and re-running your code?
Andrew
 

dforgacs

Board Regular
Joined
Jul 16, 2004
Messages
108
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
 

Watch MrExcel Video

Forum statistics

Threads
1,129,804
Messages
5,638,450
Members
417,025
Latest member
MusterDuster

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
Top