Results 1 to 5 of 5
  1. #1
    rdougherty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Location
    Michigan
    Posts
    91

    Error: 3109 "Too Many fields defined" when using TransferSpreadsheet method


    I am receiving this error when exporting a spreadsheet using the acTransferSpreadsheet method in VBA.

    The help states that this is due to having more than 255 fields, but there are only 12! I have used this exact code to export a query with 24 fields, successfully, so I do not yet understand why this is happening to this new setup.

    The query being exported is based on two linked queries, each with its own grouping. Does anyone know why this happens?

    To be clear, the query works fine and runs just fine on its own. It is only when it is exported, that this error occurs, and ONLY after adding ANY 12th field.

  2. #2
    rdougherty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Location
    Michigan
    Posts
    91
    I may have found the fix I need for today, but it will probably happen again. I found a quote from someone on another forum:
    "i tried to repair the database... no luck there

    so i deleted the spreadsheet and created a new one... this appears to have solved the problem..

    Thanks"
    I opened the spreadsheet that this is supposed to export to and replace each time, and it had zero data in it, and zero field names. Something must have failed to overwrite one time, and then after that, it didn't know how to match things up and overwrite again. Weird...

    IF no one has other advise, please mark as "Solved"...

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I use acTransferSpreadsheet a lot and never have any problems (office 2010).

    What are you using for the "SpreadsheetType" parameter?
    If Excel is 2010-2016, you should be using"acSpreadsheetTypeExcel12Xml" with the file name extension of ".xlsx".

    FYI:
    "acSpreadsheetTypeExcel12Xml" is for A2007
    "acSpreadsheetTypeExcel9" is for A2000 and earlier - with extension of ".xls" .


    You might want to set a bookmark to Ken Snell's site http://www.accessmvp.com/kdsnell/EXCEL_MainPage.htm

  4. #4
    rdougherty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Location
    Michigan
    Posts
    91
    Here is the line of code I am using. I have never been able to save this to any type but .xlsb which is chosen because it will not let me use .xlsx in the filename parameter...

    EDIT: Ahh.. apparently the "xml" at the end of the acspreadsheettypeexcel12 parameter, allows for .xlsx. Thanks , I did not know that. That will be useful for possibly replacing data in an existing table I think.

    Code:
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qry_BUILD_REPORT", "\\redactedservername\Programs\(..Scorecard\Cycle time\RAW DATA\" & "PASTE_DATA_INTO_REPORT", True, "YTD DATA"

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Ack!!! I messed up.

    In Post #3, it should have been
    FYI:
    "acSpreadsheetTypeExcel9" is for A2000 and earlier - with extension of ".xls" .
    "acSpreadsheetTypeExcel12" is for A2007
    "acSpreadsheetTypeExcel12Xml" is for A2010 - A2016

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Redemption email error "Variable not defined"
    By SidCharming in forum Programming
    Replies: 3
    Last Post: 08-08-2018, 08:51 AM
  2. Replies: 1
    Last Post: 03-14-2013, 12:39 PM
  3. Replies: 1
    Last Post: 12-14-2012, 12:32 AM
  4. "Too many fields defined" error
    By Matthieu in forum Queries
    Replies: 1
    Last Post: 01-28-2010, 08:55 PM
  5. Error: "User-defined type not defined"
    By mastromb in forum Programming
    Replies: 10
    Last Post: 01-08-2010, 02:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums