473,503 Members | 3,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change Shift key by another key to open file access

Alias90
23 New Member
Hi everybody!
As You know, we can open the design view in access by hold Shift key and Open. However, I want to prevent users open my file access in design view.
Please help me create function to change the Shift key by another key. Thanks for assistance!
Oct 9 '12 #1
13 8378
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
You can run this bit of code from any other access database:
Expand|Select|Wrap|Line Numbers
  1. Public Sub DisableShiftKeyBypass(strDB As String, bEnabled As Boolean)
  2.  
  3.    Const conPropNotFound = 3270
  4.  
  5.    On Error GoTo err_Handler
  6.  
  7.  
  8.    Dim db As DAO.Database
  9.    Set db = OpenDatabase(strDB)
  10.          db.Properties("AllowByPassKey") = bEnabled
  11.    db.Close
  12.    Set db = Nothing
  13.    Exit Sub
  14.  
  15. err_Handler:
  16.    If Err.Number = conPropNotFound Then
  17.       Dim prop As DAO.Property
  18.       Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, bEnabled)
  19.       db.Properties.Append prop
  20.       Resume Next
  21.    Else
  22.       MsgBox "Procedure [DisableShiftKeyBypass] was not succesfull" & vbNewLine & Err.Number & Err.Description
  23.    End If
  24.  
  25. End Sub
This will disable or enable the shift bypass key.

Note that it is just as easy for another user with the same or similar code to re-enable it. This is simply to prevent the average nosy user from getting to the backstage.

You can make access difficult to get too, but making it 100% secure is not possible. In most cases where access is used it also is not necessary.
Oct 9 '12 #2
Alias90
23 New Member
Thank for assitance !!
But i want to change Shift key by another key. just only the owner can open it. i tried on some functions disable Shift in internet.However, if users is good person in access , they stell can enable SHift by function .That reason I want to change the another key replace Shift key.Please help me. Thanks a lot of!!!!!
Oct 9 '12 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
You cannot completely disable it, in such a way as it can't be re-enabled.

You can compile your code, and release it as a MDE/ACCDE, with keyboard shortcuts disabled, and navigation pane hidden, and the shift key disabled. You can add password protection to your modules, but access will never be 100% safe.
Oct 9 '12 #4
Seth Schrock
2,965 Recognized Expert Specialist
You can use Access Runtime for those users that don't need administrative access. This takes away all design ability (VBA, Shift+open, navigation pane, etc.). If you are running Access 2010, then Access Runtime 2010 is free. I use this all the time at work. I have one of the only Access licenses while all the users just have Runtime.
Oct 9 '12 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I haven't used runtime, but wouldn't that only work if they don't have a license for it?
Oct 9 '12 #6
Seth Schrock
2,965 Recognized Expert Specialist
I assume you mean a license for Access? What happens is that you package the database which creates an installation file with a .accdr extension which defaults to open with Runtime even if Access is installed. I'm not sure if Access can even open a .accdr file or not. The only issue with runtime is that all ribbon bar (Access 2007 & 2010) controls are gone. If you need certain abilities (copy, cut, paste, etc.) in the ribbon bar, they must be added manually.
Oct 9 '12 #7
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
As I said, no real experience with runtime but I believe I heard that you can simply rename the filetype accdb and you are back in business. That might just be my mind going though.
Oct 9 '12 #8
Seth Schrock
2,965 Recognized Expert Specialist
I just tested your theory and you are correct. Renaming it does get you past the security.
Oct 9 '12 #9
NeoPa
32,557 Recognized Expert Moderator MVP
Alias90:
But i want to change Shift key by another key. just only the owner can open it.
The Bypass Key (Shift) is inbuilt into the Access (and all Office) application. Unless you join the MS Access development team you won't be able to manage that.

If you disable the Bypass key for your project though, you could add some code to check for another key as the first code to run in the form that is set to open by default when the project is started. If the key is detected at that point then the code could stop and this would give a very similar result to the Bypass key.
Oct 12 '12 #10
Alias90
23 New Member
Thanks NeoPa a lot of!!!
Oct 12 '12 #11
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Just because you can code your own sort of "shift" functionality, just remember that you are not going to remove the ability of someone else to re-enable the shift. You can set a password on your entire DB which means the user must have the password to disable the shift. This however also means the user must have the password to use the database, so you are pretty much back to start.
Oct 12 '12 #12
NeoPa
32,557 Recognized Expert Moderator MVP
@Alias90
You're welcome :-)

A new thread was created to handle the topic of discussion that grew from this one. It can be found at Discussion: Comments on Alternative Bypass Key.
Oct 12 '12 #13
Alias90
23 New Member
Thanks everybody a lot of! a new thread is great! I hope we have more and more good threads for us who are newbie in access to improve our exp
Oct 16 '12 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

13
2167
by: John Howard | last post by:
I have the following in a jythonc program to be executed in a html file. f1 = open("filename","r") I get message about filePermission read error. Program compiles and jar file is created....
6
2046
by: Jakob Bieling | last post by:
Hi, I was wondering why there are file access modes, which you have to specify when opening the file. I am specifically talking about the 'read', 'read-write' and 'write' distinction. As far as...
1
4488
by: N. Graves | last post by:
Help me please? I'm have users import tables from other Access Database in one of the process needed to use my ADB. To do this the user opens a form with a field for the file directory and...
6
2791
by: Cable | last post by:
Hello, I am hoping that someone can answer a question or two regarding file access. I have created an app that reads an image from a file then displays it (using OpenGL). It works well using...
2
2083
by: Vinayak Raghuvamshi | last post by:
I have a file that has been created using shared read/write access. But C# code never is able to open this file for read and keeps throwing "...cannot open file as it is being used by another...
10
2116
by: vvenk | last post by:
Hello: When I tried to use an Access database, I get the following exception: Server Error in '/WebGrid' Application....
4
26784
by: CliffKing | last post by:
I am trying to use Windows Task Scheduler to run a batch file for an already open MS Access database. Below is the syntax to the batch file: Batch file: DailySalesExport.bat REM This runs the...
1
19847
by: ABCL | last post by:
Hi All, I am working on the situation where 2 different Process/Application(.net) tries to open file at the same time....Or one process is updating the file and another process tries to access...
5
11162
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
4
7867
by: Wayne | last post by:
How do I get rid of the generic Windows "Open File - Security Warning" that appears when I try to open a database that resides on another PC on my home network? This is not the annoying macro...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.