Compile Error: Invalid Qualifier

dgunbreakable

New member
Local time
Today, 07:33
Joined
Oct 13, 2014
Messages
7
Hello, I have the code below and am trying to have a a form allow Text Box to become visible based on selected items from a List box. Can some one please help as I am getting the error listed?

THANK YOU...<<<<<<<<<<<<<<<

SQL:
Private Sub specific_opt_Click()

Dim users As Control
Dim ctrler As String
Dim xx As Long

If Me.specific_opt = True Then GoTo 169
Exit Sub

169:
Me.equal_opt = False
assign_lbl.Visible = True

Dim i As Integer, selCount As Integer

For i = 0 To slct_auditor.ListCount - 1
If slct_auditor.Selected(i) = True Then selCount = selCount + 1

Next

Any_Selected = CStr(selCount)

If Me.specific_opt = True And selCount = 0 Then MsgBox "Please select at least 1 Auditor!"
If Me.specific_opt = True And selCount = 0 Then Exit Sub

For xx = 1 To selCount

ctrler = "user" & xx
If xx > 0 Then
ctrler.Visible = True
Else
End If

Next xx

End Sub
 
Last edited by a moderator:
[sigh] sigh [/sigh]
The use of GoTo with a label for decision making should be re-evaluated.

For Starters:
Does your code module have
Option Explicit
at the top of the module?
If not, add this line then recompile the code page.
Repeat for every code module.

2nd line of code add:
On Error GoTo ErrTrap

2nd to bottom line just above the End Sub add:
Exit Sub
ErrTrap:
msgbox Err.desription

Now what happens?
 
Just an add to what RX suggested:
Replace 169 to (say) lbl169 . Use this exact syntax, with NO spaces between the word lbl and the word 169.
 
If it worked, please post your changed code.
Use the Code tags around the code.
open square bracked CODE close square brackets
your code
open square bracket /CODE close square brackets

Also, as the poster, go to your first post, under thread tools, mark your thread as SOLVED

This will help many others later who are searching for a solution

I remember Romania well. In High-School (way before Internet), I joined a international pen-pal organization.
Established a regular coorespondence with a girl my age in Romania. Sent her posters of Rock & Roll and other things in the 1960's.
A few years later, I was undergoing what someone might call a fairly high-level background check for the then Cold War efforts.
On the application, the question about communicating or relationships with a member of the Communist Party was always answered No, truthfully by me.
After totally passing extensive polygraph test, fustrating those running the test, they proceeded to confront me with every pen pal coorespondence date and detailed content.
My Romanian girl friend failed to mention that daddy was someone in the top ten government offical positions, tied to the Kremlen.
That was just a little more shocking than a "dear john" letter. Being interrigated about things a teen would discuss with each other during teen year... whew!
 
Last edited:
@Rx
I'm glad because you remember a small country as Romania but, even if I don't understand (or speak) very well English, I am very sorry that what you remembers seems to not be too good.
All the bests !
 
When I add "Option Explicit" I get Compile Error: Invalid inside procedure. This code is not being run in a module, its part of an event on a form. I tried to run it with the other code the you provided, but it skips the error handler breaks the code and goes to the Invalid Qualifier error.
 
Keep the Option Explicit but remove the error handler.
Run the code.
In what line the code is stopped ? What is the error message (again) ?
 
Same error at the same spot:

Compile Error: Invalid qualifier

ctrler.Visible = True
 
Hm :)
ctrler is a STRING

Dim users As Control
Dim ctrler As String
Dim xx As Long

.and a string can't be visible or invisible.

So, if your text box is named also "ctrler" change one of this names.
Good luck !
 
Thank you Mahail, you got me looking in the right direction... it was actually the xx variable that I was using in the loop to try to assign the different text box names. unless there is a better way to assign the variables I will have to spell them out so I took out the loop and am going to use this ugly bit of code.

If selCount = 1 Then Me.user1.Visible = True
If selCount = 2 Then Me.user1.Visible = True
If selCount = 2 Then Me.user2.Visible = True
If selCount = 3 Then Me.user1.Visible = True
If selCount = 3 Then Me.user2.Visible = True
If selCount = 3 Then Me.user3.Visible = True
If selCount = 4 Then Me.user1.Visible = True
If selCount = 4 Then Me.user2.Visible = True
If selCount = 4 Then Me.user3.Visible = True
If selCount = 4 Then Me.user4.Visible = True
If selCount = 5 Then Me.user1.Visible = True
If selCount = 5 Then Me.user2.Visible = True
If selCount = 5 Then Me.user3.Visible = True
If selCount = 5 Then Me.user4.Visible = True
If selCount = 5 Then Me.user5.Visible = True
If selCount = 6 Then Me.user1.Visible = True
If selCount = 6 Then Me.user2.Visible = True
If selCount = 6 Then Me.user3.Visible = True
If selCount = 6 Then Me.user4.Visible = True
If selCount = 6 Then Me.user5.Visible = True
If selCount = 6 Then Me.user6.Visible = True
If selCount = 7 Then Me.user1.Visible = True
If selCount = 7 Then Me.user2.Visible = True
If selCount = 7 Then Me.user3.Visible = True
If selCount = 7 Then Me.user4.Visible = True
If selCount = 7 Then Me.user5.Visible = True
If selCount = 7 Then Me.user6.Visible = True
If selCount = 7 Then Me.user7.Visible = True
If selCount = 8 Then Me.user1.Visible = True
If selCount = 8 Then Me.user2.Visible = True
If selCount = 8 Then Me.user3.Visible = True
If selCount = 8 Then Me.user4.Visible = True
If selCount = 8 Then Me.user5.Visible = True
If selCount = 8 Then Me.user6.Visible = True
If selCount = 8 Then Me.user7.Visible = True
If selCount = 8 Then Me.user8.Visible = True
 
Thank you Mahail, you got me looking in the right direction...

Due to a bug in the forum software this message was "unapproved" (hidden) for some considerable time. I have just approved it. I hope no one has been inconvenience too much! The new forum software no longer has this bug, so this problem should not reoccur.
 
I'll say. Almost six years!

The Old forum software had a bug which randomly "unapproved" posts. The new forum software has showed up the errors nicely, there were over 300 "unapproved posts". Myself and Colin - Isladog, have been working through the list, deleting irrelevant ones, approving those which look like they should be approved. We have a very loose criteria. Because of the nature of the task, expect some mistakes! (90 left to go!)
 
Because of the nature of the task, expect some mistakes! (90 left to go!)
If that means there might be other real old ones that get updated by this, I can say it's not "might be" but I wasn't going to keep repeating that message as I could see that you were hard at work. Better you than me!
 
If that means there might be other real old ones that get updated by this,
Yes I think it's important to show these hidden messages because a lot of them are "thank you's". They're not valuable in the sense of adding knowledge to the forum, but they are very valuable in letting people know that their answer was not ignored, even if they only find out 10 years later!
 
As long as you're going to make a project out of this I'm wondering if you care that there's no such word as reoccur?
 
I could write my own dictionary too. I guess all we need to do to make a non word a word is to continually use it and spread the habit. Eventually it will end up in someone's dictionary. Ain't that grand?
 

Users who are viewing this thread

Back
Top Bottom