billcute
asked on
Run-Time Error 2101 - Invalid Settings
I am getting the following error each time I click on any of the page tab of the Tab Control of my main form. Any suggestion as to how to correct this?
Run-Time Error '2101': - "The settings you entered is not valid for this property
and debug highlights the line below...
If Me.Dirty Then Me.Dirty = False
from this code....
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False '<<---- Error Line
' .......................... ....
' .......................... ...
' .......................... ...
End If
End Sub
Run-Time Error '2101': - "The settings you entered is not valid for this property
and debug highlights the line below...
If Me.Dirty Then Me.Dirty = False
from this code....
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False '<<---- Error Line
' ..........................
' ..........................
' ..........................
End If
End Sub
ASKER
I have this public declaration in the form.
Public blnDirty As Boolean
I tried what you suggested but the error problem still exist after trial.
Public blnDirty As Boolean
I tried what you suggested but the error problem still exist after trial.
it has to be blnDirty and not Dirty...
this will be the write syntax if you variable name is blnDirty...
If Me.blnDirty Then Me.blnDirty = False
this will be the write syntax if you variable name is blnDirty...
If Me.blnDirty Then Me.blnDirty = False
ASKER
I tried your last suggestion...and I am getting another error...
compile error:
"method or data member not found"
and debug highlighlighted...
blnDirty
Let me throw more light into my form's design that I am experimenting...
In my form I have two check fields..
chkDirty and chkNice
chkNice is for form error message while the other is for detecting form editing
Here is the code for form error if this would help find the solution:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
'Testing to knock off this Error Handling
If Not Me.chkNice Then
Exit Sub
End If
'If we've got a closing form error ignore it - it's because of an immediately prior Update cancelation.
If DataErr = 2169 Then
Response = acDataErrContinue
End If
End Sub
compile error:
"method or data member not found"
and debug highlighlighted...
blnDirty
Let me throw more light into my form's design that I am experimenting...
In my form I have two check fields..
chkDirty and chkNice
chkNice is for form error message while the other is for detecting form editing
Here is the code for form error if this would help find the solution:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
'Testing to knock off this Error Handling
If Not Me.chkNice Then
Exit Sub
End If
'If we've got a closing form error ignore it - it's because of an immediately prior Update cancelation.
If DataErr = 2169 Then
Response = acDataErrContinue
End If
End Sub
Hello billcute,
Please post the sub in its entirety, and confirm that this is in a Form module.
Regards,
Patrick
Please post the sub in its entirety, and confirm that this is in a Form module.
Regards,
Patrick
ASKER
This is the entire Sub plus the checkbox "chkDirty" design in the form.
....and the form's control source is..
=[Forms]("frmMain").[Dirty ]
' **********
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False
End If
End Sub
....and the form's control source is..
=[Forms]("frmMain").[Dirty
' **********
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False
End If
End Sub
First ...
I'm not seeing what you need this for
Public blnDirty As Boolean ?
And this would never work:
If Me.blnDirty
because blnDirty is not a property of the form, but instead a Public variable
Finally ... all you really need is:
Me.Dirty = False
You don't need to test if it's True first.
But, there is nothing inherently wrong with
If Me.Dirty Then Me.Dirty = False ' should not be give error 2101 - assuming this IS in a Form module.
Also:
jaiganeshsrinivasan:
check whether Me.Dirty is of boolean(bit) type
mx
Dirty is a Boolean data type.
I'm not seeing what you need this for
Public blnDirty As Boolean ?
And this would never work:
If Me.blnDirty
because blnDirty is not a property of the form, but instead a Public variable
Finally ... all you really need is:
Me.Dirty = False
You don't need to test if it's True first.
But, there is nothing inherently wrong with
If Me.Dirty Then Me.Dirty = False ' should not be give error 2101 - assuming this IS in a Form module.
Also:
jaiganeshsrinivasan:
check whether Me.Dirty is of boolean(bit) type
mx
Dirty is a Boolean data type.
More:
Not sure about that syntax ??
=[Forms]("frmMain").[Dirty ]
' **********
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False
End If '** Get rid of this End If
End Sub
mx
Not sure about that syntax ??
=[Forms]("frmMain").[Dirty
' **********
Private Sub MyTabControl_Change()
If Me.Dirty Then Me.Dirty = False
End If '** Get rid of this End If
End Sub
mx
ASKER
mx,
Still the error persist.
The "End If is for something else...
Thanks
Still the error persist.
The "End If is for something else...
Thanks
ok ... can you post the entire code ... and note the line where this error occurs .
mx
mx
Just making sure... You can use Me.Dirty only on forms that have a Record Source. If your form is unbound, then you would get that error...
(°v°)
(°v°)
ASKER
Form is bounded to a table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To All experts,
Please accept my sincere gratitude for assisting. PDB's links resolved the problem.
Regards
Bill
Please accept my sincere gratitude for assisting. PDB's links resolved the problem.
Regards
Bill
Thanks Bill. Glad I was able to help.
then try setting it like this
Me.Dirty = 0 '(for false)