
vb4.0 and access 2.0 security question
Can anyone explain why the following code works using VB 4.0 and Access
2.0?
The code allows me access to a secured database. The username "MyUserName"
is not valid in the system MDA and when I use a valid username and password
I get an error message number 3028 "the system database is missing or
opened exclusively by another user".
Thanks in advance for your assistance.
Private Sub Command1_Click()
Dim wsWork As Workspace, dbDatabase As Database, rsRecord As Recordset
Dim co, claim#, box#, bin#, MyUserName As String
On Error GoTo ErrHandler
MyUserName = DBEngine.Workspaces(0).UserName
DBEngine.IniPath = "c:\windows\msacc20.ini"
Set wsWork = DBEngine.CreateWorkspace("Special", MyUserName, "")
Set dbDatabase = wsWork.OpenDatabase("f:\apps\access\workdir\storage.mdb")
Set rsRecord = dbDatabase.OpenRecordset("box and bin")
Do Until rsRecord.EOF
co = rsRecord![co]
box# = rsRecord![box#]
bin# = rsRecord![bin#]
rsRecord.MoveNext
MsgBox co & claim# & box# & bin#
Loop
End Sub