• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

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
0
billcute
Asked:
billcute
  • 5
  • 4
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
How about just

mCtl.TabIndex ?

mx
0
 
billcuteAuthor Commented:
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  
0
 
puppydogbuddyCommented:
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


           
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
puppydogbuddyCommented:
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
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
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
0
 
billcuteAuthor Commented:
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
0
 
puppydogbuddyCommented:
Bill,
From what I can determine, the tabindex property should reference control objects within the context of a form or subform object.  I am not sure how the context would be implemented.  You might try syntax like the following:
 If mCtl.ControlType = acSubform Then
   If mCtl.Properties("TabIndex") <= Screen.ActiveControl.Properties("TabIndex") Then
           blah blah
   End If
End If

if that does not work, see the accepted solution at this link for a possible alternative to your existing code:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20775080.html
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"Suddenly some are failing. "

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

mx
0
 
billcuteAuthor Commented:
MX,
I am using Windows Vista with all the current Updates up-to-date
0
 
billcuteAuthor Commented:
MX,
I am also using Ms Access 2003 with all the updates installed
0
 
billcuteAuthor Commented:
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
0
 
puppydogbuddyCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now