Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Reference a VBA Query from Access

That was exactly what I was looking for. Thanks

"Tim" wrote:

Try setting BackgroundQuery to False for the querytable.

Tim


"Andy" wrote in message
...
In one macro I would like to get external data from Access, and use that
data. I am able to perform an Access query on its own, but it doesn't seem
to
update until the macro is finnished. This means that I cannot reference
the
data the I am calling. While the macro is running (and the external data
have
not come yet) there is a message:

ExternalData_23: Getting Data...

Is there a way to force the external data to come in before the program
moves on.

Here is the basic structure of the macro (varConn and varSql are strings
that have connection and SQL information).

Sub query()

Dim varQuery As QueryTable
Set varQuery = ActiveSheet.QueryTables.Add(Connection:=varConn,
Destination:=Sheet1.Range("A1"), Sql:=varSql)

varQuery.Refresh

Dim i As Integer
i = 2
Do Until Sheet1.Cells(i, 1) = ""
'Do Something
Loop

End Sub

Thanks in advance!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can I use MS Query in Excel like an Append Query in Access Sam Wardill Excel Discussion (Misc queries) 0 April 11th 06 02:41 PM
Run Access query from Excel, input value to query being value in c Nagesh Excel Programming 3 December 22nd 05 02:00 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"