LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to run queries in 5 different worksheets


thanks so much for the reply.

I have a couple of questions:

1) each sheet has a query written in MSQuery.
They are not graphical, as it could not display them graphically.
the WHERE clause on all queries has this key line:

AND x.DSTI_PDS_PROJMANAGER = <manager name goes here

I can't use a parameter ( ? symbol) as it says they cant be used on
queries that cant be displayed graphically.

previoulsy I tried building the SQL using strings:

For Each rn In .Range(.[A2], .[A2].End(xlDown))
sConn =
"ODBC;DSN=NIKULIVE;UID=arsuser;PWD=arsrecon1;SERVE R=nikulive.dstintl.com;"
sSQL = "SELECT DSTI_PROJ_REF, DSTI_PDS_PROJMANAGER "
sSQL = sSQL & "FROM niku.ODF_CA_PROJECT "
sSQL = sSQL & "WHERE DSTI_PDS_PROJMANAGER = '" & rn.Value &
"'"

With Sheet4.QueryTables(1)
..Connection = sConn
..CommandText = sSQL
..Refresh BackgroundQuery:=False
End With
Next


I had problems getting this working as Sheet4 that I was testing on did
not have a query in there previoulsy. Someone suggested that I have to
ADD a Qurty table to it first, but I'm not sure how to do this.
I prefer your method - but this seems to be a problem without being
able to create parameters..

any ideas?


--
matpj
------------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=472083

 
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
Web Queries Stonewall Excel Discussion (Misc queries) 4 July 23rd 07 03:35 PM
web queries... Dave F Excel Discussion (Misc queries) 2 August 25th 06 02:15 AM
How do I combine two queries from different worksheets Jez838 New Users to Excel 1 January 11th 06 02:31 PM
Using Excel Worksheets like Access Queries Lab Dude Links and Linking in Excel 2 August 12th 05 01:26 PM
Web Queries Alistair[Data#3] Excel Discussion (Misc queries) 0 May 20th 05 12:39 AM


All times are GMT +1. The time now is 04:18 AM.

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"