 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 12th, 2003, 01:22 PM
|
|
|
Hide Database window
I have a system at work where users are accessing the tables by holding down the shift key when the database opens. F11 is disabled.
Is there anyway that I can prevent this? either by code or by allocating another key to open the database window. Any help will be appreciated as it is starting to cause me problems. Peter :(
|
|

June 12th, 2003, 01:29 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 126
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
I would suggest splitting your database and making a MDE file for the users to work out of. I have used this many times and it works wonderful! Using this method also give you the option of adding security through VBA and the users will never be able to modify or 'go around' the security.
If you need any more info about splitting the database, feel free to reply to me.
Laura 
|
|

June 12th, 2003, 02:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
|
|
Here's a coding option I posted a while back. You can use the
AllowBypassKey property to toggle by-pass key access on and off.
The following uses an Inputbox and a Password. Entering a valid
password enables the Shift key; entering an
invalid password or no password disables the Shift key.
cmdSetAllowBypassKey_Click() goes behind a command button; SetProperties
goes in a standard module. Replace "TypeYourBypassPasswordHere" with
your password.
Private Sub cmdSetAllowBypassKey_Click()
On Error GoTo Err_cmdSetAllowBypassKey_Click
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
"Please key the programmer's password to enable the Bypass Key."
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
If strInput = "TypeYourBypassPasswordHere" Then
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
"The Shift key will allow the users to bypass the startup options " & _
"the next time the database is opened.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
"The Bypass Key was disabled." & vbCrLf & vbLf & _
"The Shift key will NOT allow the users to bypass the startup options " & _
"the next time the database is opened.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_cmdSetAllowBypassKey_Click:
Exit Sub
Err_cmdSetAllowBypassKey_Click:
MsgBox "cmdSetAllowBypassKey_Click", Err.Number, Err.Description
Resume Exit_cmdSetAllowBypassKey_Click
End Sub
Public Function SetProperties(strPropName As String, _
varPropType As Variant, _
varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database
Dim 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
|
|

June 12th, 2003, 11:36 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The bypass key option is certainly a good one, however, there is a further way to stop people doing things you don't want them to do.
For the startup form, set it to have a Borderstyle = None, make the Pop Up value = yes, and the Modal value = Yes, and a DoCmd.Maximize in the Load event.
Combine this with the bypass key, and you hide the entire Access UI from your users.
A note of caution, however, you have to have a quit button on that form, otherwise the only way to quit is with Ctrl+Alt+Del
Steven
There are 10 kinds of people in the world - those who understand binary - and those with friends
|
|

April 6th, 2004, 09:46 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have apply the code "allowbypasskey" to 02 of my Access databases. One of them runs well,but the other gets stuck with "Property not found" problem. (it was stopped at the line: Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue) with the error of Type mismatch)
Given below is my code:
Sub SetStartupProperties()
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
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Resume Change_Bye
End If
End Function
It confuses me as I cannot solve this Problem. It 's highly appreciated if you could give me a hand.
Thanks so much for your support.
|
|

April 6th, 2004, 10:39 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Firts, set your Variants to the proper data type.
Is there a "CreateProperty" function somewhere in the database?
If this is a function for some COM object, have you referenced the object? Is this part of DAO? I am not familiar with DAO.
Anyway, I was probably not help, but I had to try :(
Sal
|
|

April 7th, 2004, 12:13 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
See page 47 (338 of the book) of the sample pdf chapter for a good explanation of properties that exist, exist upon setting through the user interface and creating and setting user defined properties:
http://www.oreilly.com/catalog/acces...apter/ch07.pdf
John Colby also has a pair of database samples to set the startup properties for Access 97 and 2000 databases at:
http://www.colbyconsulting.com
Click on the button: C2DbProperties
and choose one of the download files that show how to set:
StartupShowDBWindow
StartupShowStatusBar
AllowBuiltinToolbars
AllowFullMenus
AllowBreakIntoCode
AllowSpecialKeys
AllowBypassKey
properties.
Ciao
Jürgen Welz
Edmonton AB Canada
[email protected]
|
|
 |