Function to disable/enable the shift bypass key

J

John Baker

I am trying to use a function to disable/enable the shift bypass key. I am
using the following function.
My problem is that it works perfectly in one database but not in another and
I am not sure why.
I get an error of type mismatch at the line db.Properties("AllowBypassKey")
= ON_Shift

Can anyone help?


Function DeactiveShift(ON_Shift As Boolean)
On Error GoTo error
Dim db As Database
Dim prop As Property
Set db = CurrentDb()
db.Properties("AllowBypassKey") = ON_Shift
Exit Function
error: ' if not found
If Err = 3270 Then
Set prop = db.CreateProperty("AllowBypassKey", dbBoolean, ON_Shift)
db.Properties.Append prop
Resume Next
Else
MsgBox ("Function de/activate SHIFT not functioning")
Exit Function
End If
End Function


John B
 
A

antman142 via AccessMonster.com

John said:
I am trying to use a function to disable/enable the shift bypass key. I am
using the following function.
My problem is that it works perfectly in one database but not in another and
I am not sure why.
I get an error of type mismatch at the line db.Properties("AllowBypassKey")
= ON_Shift

Can anyone help?

Function DeactiveShift(ON_Shift As Boolean)
On Error GoTo error
Dim db As Database
Dim prop As Property
Set db = CurrentDb()
db.Properties("AllowBypassKey") = ON_Shift
Exit Function
error: ' if not found
If Err = 3270 Then
Set prop = db.CreateProperty("AllowBypassKey", dbBoolean, ON_Shift)
db.Properties.Append prop
Resume Next
Else
MsgBox ("Function de/activate SHIFT not functioning")
Exit Function
End If
End Function

John B

Hello,
Here's the quick answer:
1. in Access go to Access help and type in AllowBypassKey Property
then you can copy/paste the code.
or go to
2.http://msdn2.microsoft.com/en-us/library/aa223277(office.11).aspx
(its the same documentation as in the Help files; same code too.)

3. at a glance- your code declares ON_Shift but does not equal a value. This
could be the
reason why its a type-mismatch. right now as you have it, ON_Shift equals
null.

Antman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top