472,353 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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:

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

ChangePropertyDdl (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 ChangePropertyDdl(stPropName As String, _
PropType As DAO.DataTypeEnum, 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 ChangePropertyDdl_Err
Dim db As DAO.Database
Dim prp As DAO.Property
Const conPropNotFoundError = 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.Delete stPropName
Set prp = db.CreateProperty(stPropName, _
PropType, vPropVal, True)
db.Properties.Append prp
' If we made it this far, it worked!
ChangePropertyDdl = True
ChangePropertyDdl_Exit:
Set prp = Nothing
Set db = Nothing
Exit Function
ChangePropertyDdl_Err:
If Err.Number = conPropNotFoundError Then
' We can ignore when the prop does not exist
Resume Next
End If
Resume ChangePropertyDdl_Exit
End Function

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

ChangePropertyDdl ("AllowBypassKey", 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.googlegr oups.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
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...
1
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...
6
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...
4
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...
1
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...
7
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...
1
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, ...
4
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...
2
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
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.