+ Reply to Thread
Results 1 to 3 of 3

Current VBA method to query table in Access and input data back in Excel is inefficient

  1. #1
    Registered User
    Join Date
    10-24-2013
    Location
    WV
    MS-Off Ver
    Excel 2010
    Posts
    3

    Current VBA method to query table in Access and input data back in Excel is inefficient

    Hello everyone!

    Currently, i have working VBA that queries an Access table based on criteria in Column A of an Excel worksheet. The results of the query are then input into Column B. This process simulates a VLOOKUP from Excel to Access. The way the current VBA works is by looping through each cell in Column A and running the query for however many rows of data are in Column A and bringing the results back one-by-one.

    Is there a more efficient alternative to looping? Access seems to query all records at once and wondered if i could simulate it instead of looping?

    Below is the code. Please ignore the static loop range (2 to 100) and please ignore the on error resume next. The range will change every time. The range will typically be around 1,000 (but anywhere between 10 and 5,000). I have code to make the loop range dynamic and code to properly error trap, but wanted to get this working 1st.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    10-24-2013
    Location
    WV
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Current VBA method to query table in Access and input data back in Excel is inefficien

    maybe this will help...

    I was thinking i should find a way to "link" the range in Excel to the field in the Access table. If i link them together, maybe i could somehow update all of column B in Excel with the query results from Access? Like a JOIN in SQL.

    Does anyone know how to do that?

    Many thanks!

  3. #3
    Registered User
    Join Date
    10-24-2013
    Location
    WV
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Current VBA method to query table in Access and input data back in Excel is inefficien

    Anyone have any tips on how to get a response?

+ 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. Problem with Data Table based on Access Query
    By Deejaytee in forum Excel General
    Replies: 0
    Last Post: 12-30-2011, 05:25 PM
  2. Copy or Export an Access Query results back to Excel
    By MACRE0 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2008, 01:07 PM
  3. VBA - query an Access table -> results in Excel
    By rirus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2006, 02:35 PM
  4. Replies: 0
    Last Post: 03-19-2006, 08:50 PM
  5. [SOLVED] Run Access query from Excel, input value to query being value in c
    By Nagesh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-22-2005, 10:10 AM

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