Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing database from opening with Shift Double-Click 2

Status
Not open for further replies.

WantToKnowMore

Programmer
Apr 6, 2004
31
US
How do I keep someone from using Shift Double Click in windows from opening the database and having access to the tables, etc.

In the start up mode, I don't show the database window, and I even made an MDE file; but - if I shift double-click from windows, I can still get to the database window.

Any ideas?

Thanks!
 
Hi!

I think there is a FAQ about this. What you need to do is use the CreateProperty Method of the database to create a property called AllowBypassKey. Then you need to append the property to the database and finally you need to set the property to False. You will want to make a copy to practice on, and then make sure you have a developers copy to make changes to.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thanks... I've never looks at the FAQs. I found exactly what I needed (I hope, haven't tried it yet, but I'm sure it will work). There is a Remvoe the Access Bypass (Shift) Key.
 
Hi WantToKnowMore, you might want to try this:

Function DisableShift() As Boolean
On Error GoTo ErrDisableShift

Dim db As Database
Dim Prop As Property
Const CONPROPNOTFOUND = 3270

Set db = CurrentDb()

db.Properties("AllowByPassKey") = False

MsgBox ("Possibility to start up in design mode disabled. Program will be closed now. Please check if design mode is disabled")
DoCmd.Quit

ExitDisableSHift:
Exit Function

ErrDisableShift:
If Err = CONPROPNOTFOUND Then
Set Prop = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append Prop
Resume Next
Else
GoTo ExitDisableSHift
End If

End Function

Just call the function from a button or whatever, and you'll close design mode. Beware: once you do this, you lock yourself out from design mode also, so be sure that the same code can be called from within your interface with
db.Properties("AllowByPassKey") = True instead of
db.Properties("AllowByPassKey") = False

Have fun!
 
Hi gransbpa,

I combined your response along with the one before yours... I understand the code, but I can't seem to get the icon to pass in the value. I get an empty command.

I followed an example on the Microsoft web site under Access 2003 Startup and Settings Installing and Customizing Customizing Access

The article is "Set command-line options for starting Access" It finds the application OK, but no value is passed in.

Is there a setting inside of Access to accept the command passed from the icon?

Thanks ahead of time to anyone who can help.
 
The Command VBA function returns all the characters after the /cmd command line switch.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks to both of you... you helped a lot.

I finally figured out why my value wasn't getting passed in. I had a beginning quote before the entire path and my database name and then quotes around my string value. But, I forgot to put a closing quote at the end of my database name before the /cmd.. so it didn't see the value.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top