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!

ERROR WHEN OPEN PROTECTED DATABASE

Status
Not open for further replies.

pelagic

Programmer
Nov 7, 2002
97
US
Hi There,
I have the following code in my Visual basic module.

strPathtoDB2 = App.Path & "\REPORT.mdb;"

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB2 & _
" Jet OLEDB:Database Password=mypassword" 'connection string

cn1.Execute "SELECT * INTO tblREPORT IN " & _
" REPORT.mdb FROM tblDATA"

I then set the REPORT.mdb password to "mypassword"
When I run the program it gives an error message "not a valid password" at cn1.Execute statement. I don't understand how do I get this error since I have already provided the password at cn2.Open statement above.

Any hints will be appriciated.
regards
 
Obviously cn1 and cn2 are NOT the same connection.
Have you tried cn2.Execute instead of cn1.Execute ?
BTW, have you Option Explicit ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top