Excel Queries
Bill,
I was trying to get the string connection of the query, and suddenly I
realize that is a MSaccess query, but.... I was getting information form a
Oracle DB, so I made some changes to macro and this is what I got:
Sub walle()
Dim constr, constr1, SQL_CorteFact_a As String
Sheet1.Activate
ActiveSheet.Range("B2").Select
constr = Selection.QueryTable.Connection
This is the connection string I got
<"ODBC;DSN=MS Access Database;DBQ=C:\Information.mdb;
DefaultDir=C:\;DriverId=25;FIL=MS Access;
MaxBufferSize=2048;PageTimeout=5;
Then I read about Oracle strings connections, and I used the following
constr_o = "ODBC; DSN=mybapro; UId=awalle; Pwd=awalle;"
I applied to query, and the query doesnΒ΄t ask me for the username and
password,
but now I got a 1004 error
With Selection.QueryTable
.Connection = constr_o
.Refresh BackgroundQuery:=False
End With
End Sub
What else can I do???
Kind Regards
"Bill Manville" escribiΓ³:
I know it's possible not to be prompted for user id and password.
I can only suggest you check the userid and password carefully - no
extra spaces etc.
Try macro-recording the creation of another query to the same database
and check the connection string recorded against yours.
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup
|