Hello,
I have already done this with ADo and now I'm testing my skill with DAO.
Results: failure...all day failure... That's why I'm here.
I'm writing a very little apps that should just connect a secured database
and make few changes in a table (deleting/changing data).
I would really love to get this done by using DAO, but it seems I'm missing
something...i.e. I cannot connect at all and I'm collecting all the possible
error messages. Too much, also for my ego. So here I'm...desperatly asking
for some help!!
The database that I need to update is secured. It has is .mdw file and it is
launched trough a shortcut. This means Access will still continue using his
system/mdw for any other databases created on the pc.
The small apps I'm going to build is not secured at all: once is work is
done it will be deleted.
Here is what I wrote:
Private Sub Command0_Click()
Dim DBdaAgg As Database
Dim wrkSec As Workspace
Dim TBLdaAgg As DAO.Recordset
Set wrkSec = CreateWorkspace("newwrksec", "myusername", "mypassword",
dbUseJet)
Set DBdaAgg = wrkSec.OpenDatabase("grant2000try.mde")
With DBdaAgg
Set TBLdaAgg = .OpenRecordset("dspc_patient", dbOpenTable, dbDenyWrite,
dbPessimistic)
With TBLdaAgg
MsgBox .Fields(0)
End With
End With
TBLdaAgg.Close
DBdaAgg.Close
wrkSec.Close
Set TBLdaAgg = Nothing
Set DBdaAgg = Nothing
Set wrkSec = Nothing
End Sub
myusername and mypassword are the username and the password which refer to
me in the .mdw file the secured database uses.
What I think is missimng...somewhat... is a reference to this .mdw file.
Boh, help!
Rocco
Alex Dybenko - 01 Nov 2006 21:04 GMT
Hi,
here how it works at me:
DBEngine.SystemDB = "C:\mysystem.mdw"
Set wrkSec = DBEngine.CreateWorkspace("", "myusername", "mypassword",
dbUseJet)
Set DBdaAgg = wrkSec.OpenDatabase(strFilePath)

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Hello,
> I have already done this with ADo and now I'm testing my skill with DAO.
[quoted text clipped - 44 lines]
>
> Rocco
rocco - 01 Nov 2006 21:32 GMT
I tried this one but it doesn't work
After many-many-many testing... I come up with this:
Dim DBEng As Object
Set DBEng = CreateObject("DAO.DBEngine.36")
DBEng.SystemDB = CurrentProject.Path & "\grant2000.mdw"
Dim DBdaAgg As Database
Dim wrkSec As Workspace
Dim TBLdaAgg As DAO.Recordset
Set wrkSec = DBEng.CreateWorkspace("", "toledo", "1234509876", dbUseJet)
Set DBdaAgg = wrkSec.OpenDatabase(CurrentProject.Path & "\grant_2003.mdb")
With DBdaAgg
Set TBLdaAgg = .OpenRecordset("dspc_patient", dbOpenTable, dbDenyWrite,
dbPessimistic)
With TBLdaAgg
MsgBox .Fields(0)
End With
End With
TBLdaAgg.Close
DBdaAgg.Close
wrkSec.Close
Set TBLdaAgg = Nothing
Set DBdaAgg = Nothing
Set wrkSec = Nothing
And it works! I'm able to log into this secured db (GRANT_2003.mdb) without
having to log into its specific .mdw. I mean I connect to it by working on a
database logged to the default SYSTEM.MDW.
Thanks anyway!!
> Hi,
> here how it works at me:
[quoted text clipped - 52 lines]
> >
> > Rocco