Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel Access query with username/pw

hey guys,

So I have some code to query an external access database and that part
works great. However, in that query, it connects to an oracle databse
in the process and as a results prompts me for a username and password
whenever I run that external query. Is there a way to program in the
queried servers username/pw so I dont get a prompt or is that set on
the access side?

Here is my code now

Code:
    With ActiveSheet.QueryTables.Add(Connection:=Array( _
        "OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=H:\Common\QRMresid\Current Month\Outputs\VTC.mdb;"
_
         ), Destination:=Range("A1"))
        .CommandType = xlCmdTable
        .CommandText = Array("VTC Query")
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = True
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .PreserveColumnInfo = True
        .Refresh BackgroundQuery:=False
    End With
End Sub
Thanks

Greg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel Access query with username/pw

You should be able to. Look at this:

http://www.carlprothman.net/Default....orMicrosoftJet

--
Regards,
Tom Ogilvy


"Gsimmons2005" wrote:

hey guys,

So I have some code to query an external access database and that part
works great. However, in that query, it connects to an oracle databse
in the process and as a results prompts me for a username and password
whenever I run that external query. Is there a way to program in the
queried servers username/pw so I dont get a prompt or is that set on
the access side?

Here is my code now

Code:
    With ActiveSheet.QueryTables.Add(Connection:=Array( _
         "OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
 ID=Admin;Data Source=H:\Common\QRMresid\Current Month\Outputs\VTC.mdb;"
 _
          ), Destination:=Range("A1"))
         .CommandType = xlCmdTable
         .CommandText = Array("VTC Query")
         .FieldNames = True
         .RowNumbers = False
         .FillAdjacentFormulas = False
         .PreserveFormatting = True
         .RefreshOnFileOpen = False
         .BackgroundQuery = True
         .RefreshStyle = xlInsertDeleteCells
         .SavePassword = True
         .SaveData = True
         .AdjustColumnWidth = True
         .RefreshPeriod = 0
         .PreserveColumnInfo = True
         .Refresh BackgroundQuery:=False
     End With
 End Sub

Thanks

Greg


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel Access query with username/pw

Nothing there about 2 step password...

I have a pw to open the database and another pw so the query can link
to external databse...

anyone?


Tom Ogilvy wrote:
You should be able to. Look at this:

http://www.carlprothman.net/Default....orMicrosoftJet

--
Regards,
Tom Ogilvy


"Gsimmons2005" wrote:

hey guys,

So I have some code to query an external access database and that part
works great. However, in that query, it connects to an oracle databse
in the process and as a results prompts me for a username and password
whenever I run that external query. Is there a way to program in the
queried servers username/pw so I dont get a prompt or is that set on
the access side?

Here is my code now

Code:
    With ActiveSheet.QueryTables.Add(Connection:=Array( _
          "OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
  ID=Admin;Data Source=H:\Common\QRMresid\Current Month\Outputs\VTC.mdb;"
  _
           ), Destination:=Range("A1"))
          .CommandType = xlCmdTable
          .CommandText = Array("VTC Query")
          .FieldNames = True
          .RowNumbers = False
          .FillAdjacentFormulas = False
          .PreserveFormatting = True
          .RefreshOnFileOpen = False
          .BackgroundQuery = True
          .RefreshStyle = xlInsertDeleteCells
          .SavePassword = True
          .SaveData = True
          .AdjustColumnWidth = True
          .RefreshPeriod = 0
          .PreserveColumnInfo = True
          .Refresh BackgroundQuery:=False
      End With
  End Sub
 

Thanks

Greg



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Excel Access query with username/pw

When you created your link to the Oracle DB (ODBC/ORAxxx/etc) from Access,
did you not have to provide the username/PW in order to connect.
There should be some option to save PW with the connection string, so Access
can connect when required.
Then you only need to provide the username/PW to connect to Access.
I don't use Oracle, so I can't tell you exact steps.
An easy way to test/generate connection string is:
- Create a text file somewhere convenient.
- Change it's name to Test.udl
- Double click it.
- Follow the wizard to connect to the DB/server etc.
- When finished, open the file in a ext editor; you can then use that
connection string in code.

Alternatively, in Access you can do Pass-Through queries. That may be useful
to you.

NickHK

"Gsimmons2005" wrote in message
oups.com...
Nothing there about 2 step password...

I have a pw to open the database and another pw so the query can link
to external databse...

anyone?


Tom Ogilvy wrote:
You should be able to. Look at this:


http://www.carlprothman.net/Default....orMicrosoftJet

--
Regards,
Tom Ogilvy


"Gsimmons2005" wrote:

hey guys,

So I have some code to query an external access database and that

part
works great. However, in that query, it connects to an oracle databse
in the process and as a results prompts me for a username and password
whenever I run that external query. Is there a way to program in the
queried servers username/pw so I dont get a prompt or is that set on
the access side?

Here is my code now

Code:
    With ActiveSheet.QueryTables.Add(Connection:=Array( _
           "OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
   ID=Admin;Data Source=H:\Common\QRMresid\Current
Code:
Month\Outputs\VTC.mdb;"
   _
            ), Destination:=Range("A1"))
           .CommandType = xlCmdTable
           .CommandText = Array("VTC Query")
           .FieldNames = True
           .RowNumbers = False
           .FillAdjacentFormulas = False
           .PreserveFormatting = True
           .RefreshOnFileOpen = False
           .BackgroundQuery = True
           .RefreshStyle = xlInsertDeleteCells
           .SavePassword = True
           .SaveData = True
           .AdjustColumnWidth = True
           .RefreshPeriod = 0
           .PreserveColumnInfo = True
           .Refresh BackgroundQuery:=False
       End With
   End Sub
   


Thanks

Greg





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
refresh Query table using own password for each username kuh Excel Programming 2 February 7th 06 05:29 AM
Excel 2000 required username and password login for database query ISTech Setting up and Configuration of Excel 0 September 7th 05 01:11 AM
Web Query: Username and Password. Sharad Naik Excel Programming 0 December 16th 04 09:43 AM
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
query system username Kevin Perez Excel Programming 3 October 14th 03 07:30 PM


All times are GMT +1. The time now is 01:43 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"