Results 1 to 2 of 2
2003-02-25, 15:23 #1
- Join Date
- Jan 2001
- Serbia and Montenegro (Yugoslavia)
- Thanked 0 Times in 0 Posts
Lost property in Access 2002 version (Access 2K2)
I created a database using Access 2002 in an Access 2000 format. The front end is Visual Basic 6. I don't want the users to have direct access to the back end, but since security is managed by Access, if they knew what they were doing they could crack into the back end with their user level. There is a little function I found that will disable the shift key on launch, and I can set the start up options to not display any of the interface, which seems to have worked for me in the past. Now that property of the database object isn't available that I can find. I looped through the different properties and printed them:
The code I'm using errors on that property db.Properties("AllowByPassKey") doesn't exist.
'This function will disable the shift at startup causing
'the Autoexec macro and Startup properties to always be executed
If CurrentUser = "MyUserName" And GroupMembership(CurrentUser) = "Access" Then
On Error GoTo errDisableShift
Dim db As Database
Dim prop As Property
Const conPropNotFound = 3270
Set db = CurrentDb()
'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
MsgBox "Function 'ap_DisableShift' did not complete successfully."
I'm interested in not only if I can get this to work again, but if this is an appropriate security measure.
2003-02-25, 15:42 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Lost property in Access 2002 version (Access 2K2)
I copied your code to a test database in Access 2002 format. I had to take out the GroupMembership bit because it isn't known, but after that the code ran without a problem, and with the desired result.
The first time it is run, the AllowByPassKey property is unknown. The On Error handler then creates the property with a default value of False.
Database and Property are DAO objects. Do you have a reference to the Microsoft DAO 3.6 Object Library?
To be on the safe side, I always prefix DAO objects:
Dim db As DAO.Database
Dim prop As DAO.Property