Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Enter Query Password in Module

K Dales, thank you very much

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
Password protect only a single module? Don Wiss Excel Programming 1 September 2nd 05 12:42 AM
Query a Access database that has a module from Excel Oggie Excel Discussion (Misc queries) 1 January 4th 05 08:43 AM
Password protect only one VBA code module? RB Smissaert Excel Programming 1 December 31st 04 05:17 PM
Module password locked Astraweb.com Excel Programming 1 October 24th 04 05:27 PM
Class Module query Darren Hill[_2_] Excel Programming 2 January 23rd 04 04:23 PM


All times are GMT +1. The time now is 12:40 PM.

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"