Hi,
I would need to have a code that lock shif key at startup both for FE and BE, but when file "unlock_shift.txt" will be present on c:\ the shift key will be enabled.
Someone can write this code?
thanks
I found this code below on this forum but it works in another way because if the file "unlock_shift.txt" is not present the db is locked "forever" :
I would need to have a code that lock shif key at startup both for FE and BE, but when file "unlock_shift.txt" will be present on c:\ the shift key will be enabled.
Someone can write this code?
thanks
I found this code below on this forum but it works in another way because if the file "unlock_shift.txt" is not present the db is locked "forever" :
Code:
Function sara_shift_open()
Dim db As DAO.Database
Dim prop As Property
Const PropNotFound = 3270
Set db = CurrentDb()
On Error GoTo CatturaErrore
db.Properties("AllowByPassKey") = False '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).
If Dir("C:\unlock_shift.txt") <> "" Then
db.Properties("AllowByPassKey") = True 'enable shift key
End If
CatturaExit:
On Error Resume Next
Set db = Nothing
Exit Function
CatturaErrore:
If Err = PropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, True, True)
db.Properties.Append prop
Resume Next
Else
Resume CatturaExit
End If
End Function