vb4.0 and access 2.0 security question 
Author Message
 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



Sun, 21 Nov 1999 03:00:00 GMT  
 vb4.0 and access 2.0 security question



Quote:
> 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, "")

Right it seems you are doing things in the wrong order!!

set dbengine = nothing ' this initalises it
dbengine.systemdb = " path of mww file" or your inipath statement
then create the workspace.

the problem is you need to set the systemini or systemdb file before
refering to other things in the dbengine such as usernames etc.. setting
the dbengine = nothing resets it.



Tue, 23 Nov 1999 03:00:00 GMT  
 vb4.0 and access 2.0 security question

Hallo TRG,
my problem was the same special by using vb16. The following code works
fine.
I hope, you can make a use of it.  

sabine

  Set f = FD_Anmelden
  f.Show 1
  a_name = FD_Anmelden!a_name.Text
  a_password = FD_Anmelden!a_password.Text
  Unload FD_Anmelden
  Set e = DBEngine
  e.IniPath = "c:\normgas\normgas4.0\normgas4.ini"
  Set e = Nothing
  Set e = DBEngine
  e.DefaultUser = a_name
  e.DefaultPassword = a_password
  Set ws = e.CreateWorkspace("sitzung1", a_name, a_password)



Fri, 26 Nov 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. vb4.0 and access 2.0 security question

2. VB4 - 32 -> Access 2.0 Security

3. vb40 and access 2.0 security question

4. Access 2.0/Jet/VB4 question

5. Access 2.0 security without System.mda

6. VB5 and Access 2.0 Security

7. Security for Access 2.0

8. VB 4.0 and Access 2.0 security problem

9. VB3 & MS Access 2.0 ...SECURITY

10. Access 2.0 / VB 4 table security ?

11. Access 2.0 security

12. Access 2.0 Security for Crystal Report

 

 
Powered by phpBB® Forum Software