Link to home
Start Free TrialLog in
Avatar of billcute
billcute

asked on

Invalid Reference to property Tab Index

I use the line code below to check as I go through my form. I code along with a function both on the fly checking up to current tab index and also total checking for submitting.  Any suggestion as to how correct this error?

Run-Time Error '2455':
"You entered an expression that has an invalid reference to the property Tab Index"

...on this line..

If mCtl.Properties("TabIndex") <= Screen.ActiveControl.Properties("TabIndex") Then
End If

...............from this function below:

Public Function chkCtl(ByRef mCtl As Control) As Boolean
  chkCtl = True
      If mCtl.Properties("TabIndex") <= Screen.ActiveControl.Properties("TabIndex") Then
  Select Case ExtractTag(mCtl.Tag, 2)
    Case "ne"
      If Len(Nz(mCtl.Value)) = 0 Then chkCtl = False
    Case "1ne"
      If Len(Screen.ActiveForm.txtPermitNo) > 0 And Len(Nz(mCtl.Value)) = 0 Then chkCtl = False
    Case ">0"
      If Not Nz(mCtl.Value) > 0 Then chkCtl = False
    Case "tf"
      If Nz(mCtl.Value, 99) <> 0 And Nz(mCtl.Value, 99) <> -1 Then chkCtl = False
  End Select
    End If
End Function
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

How about just

mCtl.TabIndex ?

mx
Avatar of billcute
billcute

ASKER

MX,
I tried this one based on your suggestion above and I still received the same error upon  clicking the btnAddNew button

  If mCtl.Properties("mCtl.TabIndex") <= Screen.ActiveControl.Properties("mCtl.TabIndex") Then  
Hi Bill and Mx
Good to see you guys around.  Try this and see if it works for you:

           If mCtl.TabIndex <= Screen.ActiveControl.TabIndex Then

PDP


           
PS:
Bill,
I think the syntax I used above is what Mx was trying to tell you to use, so if it works, he deserves the points.
PDB
Bill ... I meant what pDog posted ...  not this:

  If mCtl.Properties("mCtl.TabIndex") <= Screen.ActiveControl.Properties("mCtl.TabIndex") T

I see what you did now.  Try what pDog posted ...

mx
Hi PDB,
Long time. Are you okay?
You will not beleive that these code used to work. Suddenly some are failing. I dont know why. I tried re-tracing steps, but failed.
Also on one of my current posts, your once assisted line code added to my control tab doesnt work anymore...    

.....things are changing fast.

Back to the topic, your posted amendment did not work either. I received an error..
"object doesnt support this property or method."

Regards
Bill
ASKER CERTIFIED SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"Suddenly some are failing. "

Did you happen to install Service Pack 3  (SP3) ??  There are MANY issues, apparently ... stuff that worked ... doesn't.

mx
MX,
I am using Windows Vista with all the current Updates up-to-date
MX,
I am also using Ms Access 2003 with all the updates installed
mx,
Please accept my sincere gratitude for assisting.
PDB's posted code above resolved the conflict. More importantly, the link PDB provided was an added bonus. It was as if "qwqaw" wrote the triple generic code for me.  No errors at all - it worked on the fly.

I appreciated your assistance but I am convinced that PDB deserves the credit.

Regards
Bill
Bill,
Thanks. I am glad I was able to help resolve your problem. No worries about Mx...he and I have participated on many questions together, and both of us are amenable to whatever split is decided upon.the original poster.  Take care and best wishes for continued success with your project.

PDB