Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Multiple queries

Hi,

i have workbooks with multiple database queries on various sheets within the
workbook. If I set it to not store the password with the query I am prompted
for a username and password. The problem is, if I run the code
ActiveWorkbook.RefreshAll i have to enter my user name and password for each
query the first time it runs. I have setup a userform to capture the username
and password, but now I want to pass this into each query prior to the
refresh.

when I record a macro for creating the initial query it captures all the
code necessary, but when I perform a refresh where I have to enter a username
password, it does not show this code for the username/password being
recorded...

I have tried code like:

ActiveWorkbook.RefreshAll (Connection:= _
"ODBC;DRIVER={Microsoft ODBC for Oracle}; _
UID=' & myUsername & ";PWD=' & myPassword & ";SERVER=mv;")
and
ActiveSheet.QueryTables (Connection:= _
"ODBC;DRIVER={Microsoft ODBC for Oracle}; _
UID=" & myUsername & ";PWD=" & myPassword & ";SERVER=mv;")

but I keep getting an error message indicating I need an = sign...

thoughts?

Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Multiple queries

Not sure, but try putting a double-quote ", so:

"ODBC;DRIVER={Microsoft ODBC for Oracle}; _
becomes
"ODBC;DRIVER={Microsoft ODBC for Oracle};" _

and

UID=' & myUsername & ";PWD=' & myPassword & ";SERVER=mv;")
"UID=' & myUsername & ";PWD=' & myPassword & ";SERVER=mv;")


arunkhemlai



"Simon Shaw" wrote:

Hi,

i have workbooks with multiple database queries on various sheets within the
workbook. If I set it to not store the password with the query I am prompted
for a username and password. The problem is, if I run the code
ActiveWorkbook.RefreshAll i have to enter my user name and password for each
query the first time it runs. I have setup a userform to capture the username
and password, but now I want to pass this into each query prior to the
refresh.

when I record a macro for creating the initial query it captures all the
code necessary, but when I perform a refresh where I have to enter a username
password, it does not show this code for the username/password being
recorded...

I have tried code like:

ActiveWorkbook.RefreshAll (Connection:= _
"ODBC;DRIVER={Microsoft ODBC for Oracle}; _
UID=' & myUsername & ";PWD=' & myPassword & ";SERVER=mv;")
and
ActiveSheet.QueryTables (Connection:= _
"ODBC;DRIVER={Microsoft ODBC for Oracle}; _
UID=" & myUsername & ";PWD=" & myPassword & ";SERVER=mv;")

but I keep getting an error message indicating I need an = sign...

thoughts?

Simon

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
queries with multiple criteria Sandre Excel Discussion (Misc queries) 3 June 19th 09 02:03 AM
multiple queries in Excel RickT Excel Programming 1 March 14th 05 06:37 PM
Multiple worksheet queries liam Excel Worksheet Functions 3 February 16th 05 06:52 PM
Multiple Web Queries Andreww[_2_] Excel Programming 3 December 8th 03 10:46 PM
Multiple queries using *.dqy files Bart E Excel Programming 0 August 29th 03 11:45 AM


All times are GMT +1. The time now is 08:10 AM.

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

About Us

"It's about Microsoft Excel"