allow bypasskey property

G

Guest

dear friends,
i set up the start up to an form only and hide the database window &
i don't want the usere to see the data base window
but they were aware of opening d'base by pessing shift + enter key
(1) how to assain my own key to open the data base window,on opening.
(2) kindly tell me programatically about the the extent of use of Allow
bypasskey property
 
G

gd

dear friends,
i set up the start up to an form only and hide the database window &
i don't want the usere to see the data base window
but they were aware of opening d'base by pessing shift + enter key
(1) how to assain my own key to open the data base window,on opening.
(2) kindly tell me programatically about the the extent of use of Allow
bypasskey property

This article might be helpful. I used the same thing for a database
of mine. You just set your password in the VB code and enter an
incorrect password once to have it be disabled.
 
G

Guest

Paste the following into a module and give it a name (mine is called
"bypass"):

Public Function SetProperties(strPropName As String, _
varPropType As Variant, varPropValue As Variant) As Integer

On Error GoTo Err_SetProperties

Dim db As DAO.Database, prp As DAO.Property

Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing

Exit_SetProperties:
Exit Function

Err_SetProperties:
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function

Paste the following into the "on click" event of a text box in a form (I
called mine "bDisableBypassKey"). Insert the password where it says "PASSWORD
HERE":

Private Sub bDisableBypassKey_Click()

Dim strInput As String
Dim strMsg As String
strMsg = "Please enter the password to enable the Bypass key"
strInput = InputBox(Prompt:=strMsg, title:=" ")
If strInput = "PASSWORD HERE" Then
SetProperties "AllowBypassKey", dbBoolean, True
MsgBox "The Bypass Key has been enabled", _
vbInformation, "Set Startup Properties"
Else
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect Password. The Bypass Key was disabled", _
vbCritical, "Invalid Password"
Exit Sub
End If
End Sub


When you click on the text box you will get a password box. If it is
different, the shift bypass will be disabled.
 
G

Guest

I forgot to mention you need to ensure the "Microsoft Library 3.6 object
library" is ticked.

In the VBA screen

tools -> references

and find the reference.
 
G

Guest

I'm having an error problem with the code, same error I get with the ms
solution=>
The syntax => db.Properties(strPropName) = varPropValue and Set prp =
db.CreateProperty(strPropName, varPropType, varPropValue)

gives the error => object variable or with block variable not set.

What is causing this error?? How do I get around this??
 

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