Solved Determine AllowBypassKey is On or Off

Kha

Member
Local time
Today, 16:13
Joined
Sep 4, 2022
Messages
57
Hi, I have a button to set AllowBypassKey to False,
I am trying to type a code to determine if AllowBypassKey is On or Off, but I got error message
please help me to make it works
1664307336062.png
 
And you cannot say what that error message is? :(
Would that be because to set currentdb to a variant?
Why not Dim your variables correctly? :(
 
You need to test for the existence of the property. The error is that the property does not exist.
 
As the others have said, that property is not automatically created by Access. So, when you check for it, it may not be there yet. Just add an error handler to your code. If you get that error, then you know the setting is not set.
 
As the others have said, that property is not automatically created by Access. So, when you check for it, it may not be there yet. Just add an error handler to your code. If you get that error, then you know the setting is not set.
1664387734124.png
 
a string (txtbox) does not have a backcolor property....
 
With all due respect, using Resume Next does not really handle the error, does it?

When you get an error, you can check the error number and then react accordingly.

Just my 2 cents...
1664388918899.png
 
What's the question? @bastanu already said, since txtbox was declared as a Property, it doesn't have a member called BackColor.

If you're trying to change the color of a textbox, then use Textbox or Control, instead of Property.
Sorry, I do not understand can you give more hint please?
 
Sorry, I do not understand can you give more hint please?
You have this in your code.
Code:
Dim txtbox As Property
You can use either one of these instead.
Code:
Dim txtbox As Access.Textbox
or
Dim txtbox As Access.Control
However, you'll have to Set it first before you can change the BackColor property.
Is this function behind a Form? If so, you don't even need the Dim statements. You should be able to simply use.
Code:
Me.TextboxName.BackColor = vbRed
 
You have this in your code.
Code:
Dim txtbox As Property
You can use either one of these instead.
Code:
Dim txtbox As Access.Textbox
or
Dim txtbox As Access.Control
However, you'll have to Set it first before you can change the BackColor property.
Is this function behind a Form? If so, you don't even need the Dim statements. You should be able to simply use.
Code:
Me.TextboxName.BackColor = vbRed
1664390447000.png
 
Now, what is your question? Why can't you use words? Just curious...

The error message says you haven't defined the variable strErrMsg, because you haven't defined it yet before you used it.
1664392330468.png
 

Users who are viewing this thread

Back
Top Bottom