+ Reply to Thread
Results 1 to 2 of 2

Import Access query results into Excel show import status

  1. #1
    Registered User
    Join Date
    07-06-2016
    Location
    Mississippi, USA
    MS-Off Ver
    2010
    Posts
    1

    Import Access query results into Excel show import status

    I am using the code below to import
    the results of an Access query into Excel.
    The process takes about 60-75 seconds. How
    can I display a status bar showing how much of the import
    is complete. Either number of record count or a status bar % complete.





    Dim cn As Object
    Dim rs1 As Object
    Dim rs2 As Object
    Dim rs3 As Object
    Dim strFile As String
    Dim strCon As String
    Dim strSQL As String
    Dim x As Integer
    Dim rowcount As Integer


    Sheets("Central").Select
    Sheets("Central").Activate

    strFile = "S:\Health Economics\Team Members\Mark\Magnolia_Membership.accdb"

    strCon = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & strFile

    Set cn = CreateObject("ADODB.Connection")
    cn.Open strCon


    strSQL = "SELECT * from qry1;"

    'Added the following four lines
    Set rs1 = CreateObject("ADODB.RECORDSET")
    rs1.activeconnection = cn
    rs1.Open strSQL

    Range("D3:M6000").Select
    Selection.ClearContents

    Range("D3").CopyFromRecordset rs1

    rs1.Close

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Import Access query results into Excel show import status

    I don't think that's possible I'm afraid, when you do open the recordset control passes over to Access and only returns to the code onve the query has completed execution.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Import Access Query To Excel
    By dkannapel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 12-26-2013, 02:58 PM
  2. [SOLVED] Can I import the results of an Access Query into Excel?
    By MrChips in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-20-2012, 05:57 PM
  3. Data import Problem: Access Query to Excel
    By Minder in forum Access Tables & Databases
    Replies: 1
    Last Post: 05-25-2009, 04:23 PM
  4. Import Query in Access to Excel
    By lehainam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-13-2008, 07:50 PM
  5. VBA Code to Import Access Query Results
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2008, 12:02 AM
  6. Vlookup problem with Access Query import into Excel 2000
    By Neophyte in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-16-2006, 10:35 PM
  7. access query to import to excel
    By jazzydwit in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-16-2006, 09:05 PM
  8. [SOLVED] [SOLVED] VB Code or Excel macro to run Query/Import on Access file
    By Harry in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-22-2005, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1