Link to home
Start Free TrialLog in
Avatar of Clive Beaton
Clive BeatonFlag for Australia

asked on

Syntax of Opendatabase for a jet db to specify workgroup, user, and password.

Access 2003.  I want open a second database in my application mdb using the opendatabase method.  The second database is in a different workgroup and has Access security with a username and password.
The purpose is to set DB = (second database) so that I can run queries to import the data into the current database.  I could do it with ADO but I think this involves writing a lot of code.
Can anyone help?
Thanks in advance.
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

http://support.microsoft.com/kb/236878
Make sure you prefix the objects with 'DAO.'
Avatar of Clive Beaton

ASKER

peter57r
Thanks.  The code snippet gives an error 3029 'Not a valid account name or password' on the line: Set WS = (etc)
The account name and password are correct.
Can you help?
Thanks.
Private Function opentables() As Boolean
   Dim WS As DAO.Workspace
   Dim DB As DAO.Database
   Dim RS As DAO.Recordset
   DBEngine.SystemDB = "C:\cela\cela.mdw"
   Set WS = CreateWorkspace("NewWS", "cela_designer", "d7+_SeK!", dbUseJet)
   Set DB = WS.opendatabase("C:\cela\CELA.data.mdb")
   Set RS = DB.OpenRecordset("Users")

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks you very much.