ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enter Query Password in Module (https://www.excelbanter.com/excel-programming/347350-enter-query-password-module.html)

GregR

Enter Query Password in Module
 
What is the syntax for entereing a query password in VBA so I don't get
the username and PW prompt? TIA

Greg


K Dales[_2_]

Enter Query Password in Module
 
The User ID (UID) and password (PWD) are part of the connection string, so it
depends on the database you are using. Either your db documentation or an
online search should help with it, but you can also set up a simple query in
MSQuery (where you supply the user id and password and tell it to save them -
for now) and then look at the QueryTable.Connection property to see the
connection string format; here is a simple example:
ODBC;DSN=MyDataSource;UID=MyUserName;PWD=MyPasswor d
To code this in VB, set the string manually to include the userID and
password before running the query. But, be aware that any knowledgeable
person with access to your code can steal your db user id and password if you
do this, so if security is an issue this may not be advisable.
--
- K Dales


"GregR" wrote:

What is the syntax for entereing a query password in VBA so I don't get
the username and PW prompt? TIA

Greg



GregR

Enter Query Password in Module
 
K Dales, thank you very much

Greg



All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com