Password issue using CreateObject("Access.Application.8")

  • Thread starter Thread starter WSF
  • Start date Start date
W

WSF

Access97

I have 3 mdb's.
1 - the control front end
2 - a temporary data-only mdb - to hold session data made available to a
separate front end.
3 - a master data mdb backend.

I am experimenting with using a temporary mdb to hold session data made
available to the separate front end.
I am attempting to use code offered a couple of weeks ago by "Chadlon" and
it works great except that when opening the second temp mdb in code I am
prompted for my access login password.

Is there a way of opening, and then transferring into that temp mdb without
being asked for the login password.
This temp database is located on the users C: drive so I imaging that each
user will be prompted for their login password - so there will not be a
universal password to rely on.

The code in question is:

Dim objAcc As Access.Application
Dim DB2_Name$, tableInDB2$
Dim DB3_Name$, tableInDB3$
Set objAcc = CreateObject("Access.Application.8")
DB2_Name$ = "C:\Track\Data.mdb"
DB3_Name$ = "C:\Reports\REPORTS_TEMP.mdb"
tableInDB2$ = "tblSerialNumbers"
tableInDB3$ = "tblSerialNumbers"
objAcc.OpenCurrentDatabase DB2_Name$
objAcc.DoCmd.TransferDatabase acExport, "Microsoft Access", DB3_Name$,
acTable, tableInDB2$, tableInDB3$
objAcc.Quit
Set objAcc = Nothing

I am prompted for my Access logon password, once it is entered the table is
copied okay, seamlessly and in the background like I want it to be.

Any help gratefully appreciated

WSF
 
To simplify the issue:
I am trying to open a second mdb using CreateObject - but want to bypass the
username/password prompt.
In this case the user is the same for the control mdb and the second
(to-be-opened) mdb.
Possible?

WSF
 
I am still experimenting and have come up with the following which seems to
work, in that it gives me access to the other mdb using known username and
password.

Because the operators using this will have their own username/password is
there a way I can extract that from the current (control) mdb and pass to
this code to open the other mdb?


Dim db As Database
Dim ws As Workspace
DBEngine.SystemDB = "C:\Access\System.mdw"
Set ws = DBEngine.CreateWorkspace("XYZ", "abc", "defgh", dbUseJet)
Set db = ws.OpenDatabase("C:\Reports\REPORTS.mdb")

db.Run "ProjectName.FunctionToRun" ' haven't tried this yet.

ws.close


WSF
 
WSF said:
I am still experimenting and have come up with the following which seems to
work, in that it gives me access to the other mdb using known username and
password.

Because the operators using this will have their own username/password is
there a way I can extract that from the current (control) mdb and pass to
this code to open the other mdb?

Think a bit about what you're asking. You want your code to be able to "know"
the user's password. If that were possible it would make the password pretty
useless wouldn't it? You can grab and supply the UserName, but the user will
have to supply the password themselves.
 
Back
Top