BypassKey

G

Guest

Hi

I'm trying to secure my database on a short timescale - I've created an .mde file... Does anyone know what code I need or what actions I need to take to prevent anyone from bypassing the start-up options by using the 'BypassKey' I've searched the online help and found that I can write a macro and VB to set the 'AllowBypassKey' property of the database to 'False' but dont' really know where to go from here. Any help greatly appreciated

A
 
K

Kevin

<<<<<<<<<<<For Microsoft Access 2002>>>>>>>>

Just put this code into a module and run the SetBypassProperty



Sub SetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub

Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

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 = False
Resume Change_Bye
End If
End Function




<<<<<<<<<<<For Microsoft Access 97>>>>>>>>


Same thing, just for Microsoft Access 97




Sub SetBypassProperty()

ChangeProperty "AllowBypassKey", dbBoolean, False

End Sub

Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue 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 = True

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 = False
Resume Change_Bye
End If
End Function



Hope that helps,
Kevin S.

----------------------------------------


A. said:
Hi,

I'm trying to secure my database on a short timescale - I've created an
..mde file... Does anyone know what code I need or what actions I need to
take to prevent anyone from bypassing the start-up options by using the
'BypassKey' I've searched the online help and found that I can write a
macro and VB to set the 'AllowBypassKey' property of the database to 'False'
but dont' really know where to go from here. Any help greatly appreciated.
 
G

Guest

Thank you for your help. I've put the code into a module and tried to run it but it came up with a 'compile error: Sub or Function not defined' I new to the world of code any ideas what I've left out
Am

----- Kevin wrote: ----

<<<<<<<<<<<For Microsoft Access 2002>>>>>>>

Just put this code into a module and run the SetBypassPropert



Sub SetBypassProperty(
Const DB_Boolean As Long =
ChangeProperty "AllowBypassKey", DB_Boolean, Fals
End Su

Function ChangeProperty(strPropName As String, varPropType As Variant
varPropValue As Variant) As Intege
Dim dbs As Object, prp As Varian
Const conPropNotFoundError = 327

Set dbs = CurrentD
On Error GoTo Change_Er
dbs.Properties(strPropName) = varPropValu
ChangeProperty = Tru

Change_Bye
Exit Functio

Change_Err
If Err = conPropNotFoundError Then ' Property not found
Set prp = dbs.CreateProperty(strPropName,
varPropType, varPropValue
dbs.Properties.Append pr
Resume Nex
Els
' Unknown error
ChangeProperty = Fals
Resume Change_By
End I
End Functio




<<<<<<<<<<<For Microsoft Access 97>>>>>>>


Same thing, just for Microsoft Access 9




Sub SetBypassProperty(

ChangeProperty "AllowBypassKey", dbBoolean, Fals

End Su

Function ChangeProperty(strPropName As String, varPropType As Variant
varPropValue As Variant) As Intege
Dim dbs As Database, prp As Propert
Const conPropNotFoundError = 327

Set dbs = CurrentD
On Error GoTo Change_Er
dbs.Properties(strPropName) = varPropValu
ChangeProperty = Tru

Change_Bye
Exit Functio

Change_Err
If Err = conPropNotFoundError Then ' Property not found
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue
dbs.Properties.Append pr
Resume Nex
Els
' Unknown error
ChangeProperty = Fals
Resume Change_By
End I
End Functio



Hope that helps
Kevin S

---------------------------------------


A. said:
..mde file... Does anyone know what code I need or what actions I need t
take to prevent anyone from bypassing the start-up options by using th
'BypassKey' I've searched the online help and found that I can write
macro and VB to set the 'AllowBypassKey' property of the database to 'False
but dont' really know where to go from here. Any help greatly appreciated
 
A

Arvin Meyer

G

Guest

I have read the article that you listed but I too have received errors. Am I supposed to just copy the code into a module and save it or attach it to something else? I am confused. Thank you in advance for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top