Results 1 to 5 of 5
  1. #1
    jmk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    14

    VBA Coding error when transferred from Access 2003 to 2010 (along with Windows 7 upgr

    Hi, I have been working on fixing a database that I did not design. Yesterday, I posted an issue and thankfully that one has been resolved. We were able to find the original database and access the VBA code from there. For reference the prior post is located at:



    https://www.accessforums.net/program...tml#post192764

    Now that I have access to the VBA code the issue is debugging code that is not working properly. While attempting a to run a function of the database I received a Microsoft Visual Basic error:
    Run-time error '2282':

    The format in which you are attempting to output the current object is not available.

    This error has 3 options; continue, debug or help. When I attempt to debug this is the line of code that is not working:

    DoCmd.OutputTo acOutputTable, "tblMacroTemplate", acSpreadsheetTypeExcel9, "G:\DEPARTMENT\11224458\Shared\Jobs\SET-UP\Macro Templates\" & FileName & ".xls", True

    It appears that the database is not correctly connecting to excel for the export list function.

    Any ideas are greatly appreaciated. Thanks!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It looks to me that you have mixed up arguments.

    "acSpreadsheetTypeExcel9" is a spreadsheettype argument for the command "DoCmd.TransferSpreadsheet"

    For the command "DoCmd.OutputTo" you should try "acFormatXLS"

    So the line should be
    DoCmd.OutputTo acOutputTable, "tblMacroTemplate", acFormatXLS, "G:\DEPARTMENT\11224458\Shared\Jobs\SET-UP\Macro Templates\" & FileName & ".xls", True

    Disclaimer: I am using Access 2000, might be different in A2010.....

  3. #3
    jmk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    14
    Found a fix!

    acSpreadsheetTypeExcel9 is reffering to Excel 2003. Changing it to acSpreadsheetTypeExcel14 allows for the database to export to excel 2010. However, now a box pops up asking what output format. Is there anyway I can bypass this?

  4. #4
    jmk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    14
    Sorry, I took a while on my post and didn't see your reply. I replaced with the acFormatXLS, as you suggested, and it bypassed the output format. Works perfectly now! Thank you!

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Deleted... Was typing when you posted. Glad you fixed it.

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

Similar Threads

  1. 2113 Error happening from Access 2003 to 2010
    By johnnyflames in forum Forms
    Replies: 5
    Last Post: 06-08-2012, 01:42 PM
  2. Access to Excel (2003 version) VBA coding help
    By iamstupid in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 09:53 AM
  3. Windows 7 and smtp mail with Access 2003
    By mafhobb in forum Programming
    Replies: 1
    Last Post: 06-28-2010, 09:05 AM
  4. Access 2003 and Windows 7
    By icedude in forum Access
    Replies: 4
    Last Post: 02-03-2010, 03:18 PM
  5. Replies: 0
    Last Post: 12-13-2009, 05:15 AM

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