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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a accessDB with password protection in a DTS

Status
Not open for further replies.

balistikb

Technical User
Nov 12, 2002
177
US
I have an activeX script in a DTS that runs a query in Access 2000. I am having a problem cause everytime I run that script I have to put in the password manually. Is there a way for me to include this in my script?

Function main()
Dim objDB
Set objDB = CreateObject("Access.Application")
objDB.OpenCurrentDatabase("\\MRH1\Vol1\Home\DMS_IT\SkillsAssesment\SkillsAssesment.mdb")
objDB.DoCmd.Openquery "qryMakeTableforExport"
objDB.CloseCurrentDatabase
objDB.Quit
main = DTSTaskExecResult_Success
End Function
 
What are the options, if any, for the OpenCurrentDatabase? If you were openning the db using ADO, you would add the user name and password to the connection.open method.
 
I am not sure I understand what you mean by that.
 
The problem is if there is a password on the Access Database is that DTS needs a username for Access, which I don't think Access asks for when it prompts for a password. We had to dump all the files into excel and then use DTS to import into SQL 2000 from excel. Removing the password from Access is also an option.
 
No I haven't. I have seen scripts that includes the password in it but I can't seem to get it to work. I would rather not use excel as a solution .
 
Does
objDB.OpenCurrentDatabase("\\MRH1\Vol1\Home\DMS_IT\SkillsAssesment\SkillsAssesment.mdb",,"mypassword")

work?

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Yes, I get an error "Cannot use parentheses when calling a sub"
ANd here is the code I am using...
Function main()
Dim objDB
Set objDB = CreateObject("Access.Application")
objDB.OpenCurrentDatabase ("\\MRH1\Vol1\Home\DMS_IT\SkillsAssesment\SkillsAssesment.mdb",,"7718")
objDB.DoCmd.Openquery "qryUpdateUnmatched"
objDB.CloseCurrentDatabase
objDB.Quit
main = DTSTaskExecResult_Success
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top