473,696 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable Shift Key using AllowBypassKey

Help, please!!

I am running MS Access 2000.

I copied code from Michael Kaplan's website (see below) to disable the
shift key for all non-admin users. I pasted the code into a new
function. I then created a macro, used the Run Code command and
selected my function. When I select the function in the Expression
Builder, it appears as:

ChangePropertyD dl («stPropName», «PropType», «vPropVal»), and I
filled in the values:

ChangePropertyD dl (AllowBypassKey , DB_Boolean, False).

When I run the macro, I get "MS Access cannot find the name
AllowBypassKey you entered in the expression".

I'm new to VBA, and I'm not sure where to go from here. Any assistance
greatly appreciated.

Thanks in advance,
Mark

Code I used:
' *********** Code Start ***********
Function ChangePropertyD dl(stPropName As String, _
PropType As DAO.DataTypeEnu m, vPropVal As Variant) _
As Boolean
' Uses the DDL argument to create a property
' that only Admins can change.
'
' Current CreateProperty listing in Access help
' is flawed in that anyone who can open the db
' can reset properties, such as AllowBypassKey
'
On Error GoTo ChangePropertyD dl_Err
Dim db As DAO.Database
Dim prp As DAO.Property
Const conPropNotFound Error = 3270
Set db = CurrentDb
' Assuming the current property was created without
' using the DDL argument. Delete it so we can
' recreate it properly
db.Properties.D elete stPropName
Set prp = db.CreateProper ty(stPropName, _
PropType, vPropVal, True)
db.Properties.A ppend prp
' If we made it this far, it worked!
ChangePropertyD dl = True
ChangePropertyD dl_Exit:
Set prp = Nothing
Set db = Nothing
Exit Function
ChangePropertyD dl_Err:
If Err.Number = conPropNotFound Error Then
' We can ignore when the prop does not exist
Resume Next
End If
Resume ChangePropertyD dl_Exit
End Function

Nov 13 '05 #1
7 11025
Stab i nthe dark but:

ChangePropertyD dl ("AllowBypassKe y", DB_Boolean, False).

--
This sig left intentionally blank
Nov 13 '05 #2
Tried that and got:

"MS Access cannot find the name
AllowBypassKey you entered in the expression".

Nov 13 '05 #3
You could download my working example here:

http://www.members.shaw.ca/AlbertKal.../msaccess.html

The above lets your browse to the mdb file of your choice, and then set, or
un-set the shift key.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #4
Mark wrote:
Tried that and got:

"MS Access cannot find the name
AllowBypassKey you entered in the expression".


Sure you put the quotes around "AllowBypassKey "?

I just tried it (A2K2) and got no error.

--
This sig left intentionally blank
Nov 13 '05 #5
Ok...added the quotes. :-) I got the same error mesage, so I added
quotes around "DB_Boolean " as well, and then I got "Type Mismatch".
Could it be because I'm in Access 2000 instead of 2002?

Nov 13 '05 #6
That's DAO code: have you set a reference to the Microsoft DAO 3.6 Object
Library? (neither Access 2000 nor 2002 have the reference set by default)

While in the VB Editor, select Tools | References, scroll through the list
of available references until you find the DAO reference, select it and back
out of the dialog.

You needs quotes around the property name, but not around DB_Boolean (which
could also be dbBoolean, or the value of those intrinsic constants, 1).

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Mark" <at*****@yahoo. com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Ok...added the quotes. :-) I got the same error mesage, so I added
quotes around "DB_Boolean " as well, and then I got "Type Mismatch".
Could it be because I'm in Access 2000 instead of 2002?

Nov 13 '05 #7
Douglas J. Steele wrote:
That's DAO code: have you set a reference to the Microsoft DAO 3.6 Object
Library? (neither Access 2000 nor 2002 have the reference set by default)

While in the VB Editor, select Tools | References, scroll through the list
of available references until you find the DAO reference, select it and back
out of the dialog.

You needs quotes around the property name, but not around DB_Boolean (which
could also be dbBoolean, or the value of those intrinsic constants, 1).


Is a good point but the code has DAO. prefixes, I would think that it
wouldn't compile at all if DAO wasn't referenced. Maybe version
dependant though so if Mark had DAO 3.5 referenced instead...

--
This sig left intentionally blank
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2857
by: Mike | last post by:
I'm using a gif 1240 pixels wide x 15 pixels high as a tiled background. There seems to be a slight color shift (from beige to magenta) when the gif is used as a background vs used a image on the page. Occurs on both IE and Netscape. Anyone else come accross this? Any ideas on how to correct?
1
1969
by: Zach | last post by:
Hello. When editing XML in the Data view mode in Visual Studio .NET, if I press the spacebar while holding shift, it will select the entire row of data I'm working with, rather than just insert a space. Is there any way to disable this?
6
3732
by: PerryC | last post by:
I have search googles and there are hundreds of tips about AllowByPassKey... however, none works for me... well, perhaps I am too new to such high level functionality that it just does not make sense to me. So, anyone please help. I have no idea what is "CreateProperty" that Access help was trying to tell me to do. Can anyone please write me a step by step on how to accomplish this? (i.e. disable Shift on Startup.) I've seen many...
4
2082
by: Paul T. RONG | last post by:
Dear All, I add two new tables to the database and then the disable shift key codes don't work. These two new tables are actually created by two queries, and only these two are in the front end, I didn't manage to move them to the back end. I work with Access 2k under Win XP. these are the codes that don't work (it worked for more than a year very well):
1
2999
by: simonmarkjones | last post by:
Hi i'm trying to disable the shift key from allowing users to access the design view. I've done a search in groups and know i need to somehow do AllowBypassKey. Everywhere i look there is code and answers that dont seem to work or make sense. I want to set the bypass key to be a combination of shift + B. Please could someone detail the code and let me know exactly where to place it and how to get it to run.
7
5716
by: John Smith | last post by:
Hello, I have a simple question, I have a vb.net form with several buttons. If I store the name of a button in a variable.. Dim TheName as string TheName = Me.btnMyLittleButton.Name.ToString How can I disable this button using the variable value?
1
1665
by: Anne | last post by:
Hi, How can I in a MDE-file disable the "startup with Right Shift Key" ? I tried it in Options --Startup, but can't get it working. Thanks, Anne
4
2975
by: DaveG1946 | last post by:
I have a MS ACCESS 2003 DB which I need to secure against user tampering (both by the curious and the malicious!). My approach is to: run Access, where the mdb file is on a memory stick; secure the DB with User Level security; split the back end and front end; convert all macros to VBA; disable the shift key through VBA in the back end;
2
5824
by: Arun Anant Sule | last post by:
I want to open ms access database without navigation pane, even if shift key is pressed while opening the database
0
9140
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9005
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8869
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8845
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5848
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2304
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1988
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.