Results 1 to 7 of 7

Thread: [RESOLVED] Set Default Output (Access 97)

  1. #1

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    [RESOLVED] Set Default Output (Access 97)

    Hi all,

    I have a feeling that I know the answer to this already, but I'd like to confirm -

    Currently, when outputting tables to Excel, my version of Access outputs to Excel 5.0. This means I receive an error every time I try to output a table with over 16k rows. Is there anyway to set the database so that it default outputs to 97/2000 format?

    Thanks
    Last edited by MethadoneBoy; Feb 15th, 2006 at 05:15 AM.
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Set Default Output (Access 97)

    How are you currently doing it?

  3. #3

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: Set Default Output (Access 97)

    To export, I merely click the "Office Links -> Analyze it with MS Excel" icon on the toolbar. Presumably because it's Access 97 that I'm using, it's automatically set to output to the 97 Excel format?
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Set Default Output (Access 97)

    Yep, when writing Access 97 they obviously didn't know about the file format of future versions of Excel.

    As you have Access 97 I presume you only have Excel 97 too, is this the case? If so, you cant use Excel Automation to help.

    You could theoretically use ADO, but I'm not sure how you would create the document to add the data to.

    Another option would be to export to a CSV file, which Excel will happily open.

  5. #5

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: Set Default Output (Access 97)

    Well, actually we've got Excel 2003 here in the company. It's just Access that's a leftover from the Office 97 days.

    We were initally outputting into a csv file, but were just wondering if there was another way around it.

    Thanks for the help, all the same!
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Set Default Output (Access 97)

    If you add a reference to Excel in your access db VBA IDE you can write some code to export to Excel. You can also use late binding so it can support various versions of Excel.

    There is a .CopyFromRecordset method that you can use with the EOM to perform the export quite simply.

    VB Code:
    1. Option Explicit
    2. 'Add reference to Excel xx.0 Object Model
    3. 'Add reference to MS ActiveX Data Object 2.x Library
    4. Private Sub Export2Excel()
    5.     Dim oApp As Excel.Application
    6.     Dim ws As Excel.Worksheet
    7.     Dim iCol As Integer
    8.     Dim rs As ADODB.Recordset
    9.    
    10.     'Create rs object
    11.     'Blah, blah, blah...
    12.    
    13.     Set oApp = New Excel.Application
    14.     Set ws = oApp.Sheets("Sheet1")
    15.     For iCols = 0 To rs.Fields.Count - 1
    16.         ws.Cells(1, iCols + 1).Value = rs.Fields(iCols).Name
    17.     Next
    18.     ws.Range(ws.Cells(1, 1), ws.Cells(1, rs.Fields.Count)).Font.Bold = True
    19.     ws.Range("A2").CopyFromRecordset rs
    20.     rs.Close
    21.     Set rs = Nothing
    22.    
    23. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: [RESOLVED] Set Default Output (Access 97)

    Thanks, RobDog!

    EDIT - We've got around the issue by reverting the process so we can just send a CSV file. Thanks to anyone who contributed.
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width