saretta000
New member
- Local time
- Today, 02:03
- Joined
- Feb 21, 2009
- Messages
- 4
hi!
I'd like to use the AllowByPassKey to disable shift open key, because I'd like to hide tables and modules to users of my db. However, since my db is a database for dataentry, I need to be able to view and access to tables and modules, after users have entered data! So I need something that can disable shift_open key, but also re-enable it!
I wrote the following working function, which is run by an autoexec macro in my db:
Function sara_shift_open()
Dim db As Database
Dim prop As Property
Dim PropBool As Boolean
Const PropNotFound = 3270
Err = 0
Set db = CurrentDb()
PropBool = False
On Error GoTo CatturaErrore
db.Properties("AllowByPassKey") = PropBool 'Disable shift key
'Using the file unlock_shift.txt as "password": if the file is present on the machine (@C:\), then the shift_open key is enable. Otherwise, it's disable (on my PC the file will be present, so I will be able to enable shift_open key so to access tables).
NomeFile = "C:\unlock_shift.txt"
Err = 0
On Error Resume Next
Open NomeFile For Input As #1 'Open file: if the file doesn't exist, error 53 is returned
If Err = 0 Then
PropBool = True
db.Properties("AllowByPassKey") = PropBool 'enable shift key
Close #1 'close file
End If
CatturaErrore:
If Err = PropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", 1, PropBool)
db.Properties.Append prop
Err = 0
Resume Next
End If
End Function
I know it may be a stupid way to use AllowByPassKey property, but it's the simpler and quicker solution I found, and I think it well works!!!
What I'm kindly asking is: in your opinion will it always well work????
I don't trust a lot of access ( sorry for that
please forgive me!
).
I'm not an expert user, and it's mandatory for me to be able to access to db tables and code.
May I be sure that my function will always work and that I will always be able to enable shift_open key if the file.txt that I use as "password" is present on my machine?
Or I did some omissions/mistakes which could compromise its working in some particular occasions?
thank you in advance for your help!
sara.
I'd like to use the AllowByPassKey to disable shift open key, because I'd like to hide tables and modules to users of my db. However, since my db is a database for dataentry, I need to be able to view and access to tables and modules, after users have entered data! So I need something that can disable shift_open key, but also re-enable it!
I wrote the following working function, which is run by an autoexec macro in my db:
Function sara_shift_open()
Dim db As Database
Dim prop As Property
Dim PropBool As Boolean
Const PropNotFound = 3270
Err = 0
Set db = CurrentDb()
PropBool = False
On Error GoTo CatturaErrore
db.Properties("AllowByPassKey") = PropBool 'Disable shift key
'Using the file unlock_shift.txt as "password": if the file is present on the machine (@C:\), then the shift_open key is enable. Otherwise, it's disable (on my PC the file will be present, so I will be able to enable shift_open key so to access tables).
NomeFile = "C:\unlock_shift.txt"
Err = 0
On Error Resume Next
Open NomeFile For Input As #1 'Open file: if the file doesn't exist, error 53 is returned
If Err = 0 Then
PropBool = True
db.Properties("AllowByPassKey") = PropBool 'enable shift key
Close #1 'close file
End If
CatturaErrore:
If Err = PropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", 1, PropBool)
db.Properties.Append prop
Err = 0
Resume Next
End If
End Function
I know it may be a stupid way to use AllowByPassKey property, but it's the simpler and quicker solution I found, and I think it well works!!!

What I'm kindly asking is: in your opinion will it always well work????
I don't trust a lot of access ( sorry for that


I'm not an expert user, and it's mandatory for me to be able to access to db tables and code.
May I be sure that my function will always work and that I will always be able to enable shift_open key if the file.txt that I use as "password" is present on my machine?
Or I did some omissions/mistakes which could compromise its working in some particular occasions?
thank you in advance for your help!
sara.