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!

Not a Valid Account Name or Password with ADO

Status
Not open for further replies.

dpatrickcollins

Programmer
Nov 18, 2002
79
I am running the following code:

Public Sub Test()
Dim gobjDb As ADODB.Connection
Dim rst As Recordset

Set gobjDb = New ADODB.Connection
gobjDb.Mode = adModeReadWrite
gobjDb.Open CurrentProject.Connection, "admin", "pass"
MsgBox "Success"

End Sub

The database password for this Access 2002 Database is "pass". I am receiving the error message:

Not a valid account name or password.

Any ideas?
 
You can open recordsets on the current project connection, but I don't believe you can open additional connections on the current connection. You can open connections on other databases.
 
cmmrfrds, Thank You. As you suggested, the code above was attempting to open the current connection unnecessarily (or at least ignoring use of the current connection). The following code is the corrected version (note its simplicity).


Public Sub Test()
Dim gobjDb As ADODB.Connection
Dim rst As Recordset

Set gobjDb = CurrentProject.Connection
MsgBox "Success"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top