Mencegah User untuk Memodifikasi Database Access
Anda mungkin tidak ingin user memodifikasi form, report bahkan table
pada Microsoft Access Database yang anda buat.
Source code berikut merupakan cara untuk melindungi database anda.
Pertama-tama simpan function dibawah ini ke dalam salah satu module di
Microsoft access.
Function SetStartupProperties() As Boolean
ChangeProperty "StartupShowDBWindow", dbBoolean, 0
ChangeProperty "StartupShowStatusBar", dbBoolean, -1
ChangeProperty "AllowBuiltinToolbars", dbBoolean, 0
ChangeProperty "AllowFullMenus", dbBoolean, 0
ChangeProperty "AllowBreakIntoCode", dbBoolean, 0
ChangeProperty "AllowSpecialKeys", dbBoolean, 0
ChangeProperty "AllowBypassKey", dbBoolean, 0
End Function
Function ChangeProperty(strPropName As String, varPropType As Variant,
arPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = -1
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, varPropType,
varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = 0
Resume Change_Bye
End If
End Function
Kemudian jalankan function SetStartupProperties dari makro dengan Action
: Run Code dan namailah makro tersebut AutoExec.
Untuk lebih banyak tips programming silahkan kunjungi semut.cbj.net
<http://semut.cjb.net/>
Regards,
SemutIndo
Semut.cjb.net <http://semut.cjb.net/>
Send instant messages to your online friends http://asia.messenger.yahoo.com