?
Solved

Invalid Reference to property Tab Index

Posted on 2007-10-13
12
Medium Priority
?
265 Views
Last Modified: 2013-11-28
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
Comment
Question by:billcute
  • 5
  • 4
  • 3
12 Comments
 
LVL 75
ID: 20071509
How about just

mCtl.TabIndex ?

mx
0
 
LVL 4

Author Comment

by:billcute
ID: 20071548
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
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 20072947
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 20072953
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
 
LVL 75
ID: 20072956
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
 
LVL 4

Author Comment

by:billcute
ID: 20073179
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
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 2000 total points
ID: 20074160
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
 
LVL 75
ID: 20074349
"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
 
LVL 4

Author Comment

by:billcute
ID: 20074542
MX,
I am using Windows Vista with all the current Updates up-to-date
0
 
LVL 4

Author Comment

by:billcute
ID: 20074547
MX,
I am also using Ms Access 2003 with all the updates installed
0
 
LVL 4

Author Comment

by:billcute
ID: 20075609
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
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 20075927
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question