Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write text into a pop-up window

Status
Not open for further replies.

LinuxKommy

Technical User
Apr 2, 2002
31
US
I am having a problem connecting to an ODBC source. Even if i put the username and password in the DSN, the system ALWAYS wants the L/P and pops up a box to do so. I want it to run a query while no one is here, so there is the problem. would there be anyway for a vb script (started from task scheduler) to input the username and password without me being here?

thanks in advance,
douglas
 
VB has a "sendkeys" function - maybe it works in vb as well?
 
You have to pass the username and password from within your script when you connect to your DSN, putting it in the DSN won't usually work. Try something like this:

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=DSNName;UID=DBUser;PWD=password"

Where
DSNName = the name of your DSN
DBUser = the username you are trying to connect with
passwork = the user's password

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top