Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Checkbox2 1

Status
Not open for further replies.

hsummer

Technical User
Dec 10, 2001
13
US
I put a Checkbox1 on Userform1 and the code recognizes it. Later, I put Checkbox2 on the same form, but the code does not see Checkbox2, only Checkbox1. any ideas?

Win2k/Office2k

Harold
 
Is the control visible on the form?
Check the control's name. When writing code does the properties shortcut appear when you type 'checkbox2.'? Are you referencing the control from another form or sub?
Delete the control and add it again.

Explain your problem in a bit more detail, at thsi stage it could be anything.

D. "I want to play..."
(Guess the X-Files episode!)
 
The control is visible on the form. The name is the default (Checkbox2). When I type 'Checkbox2.' nothing happens. If i do the same for 'Checkbox1.', I get the shortcut list.

Also, when I type 'Userform1.' the shortcut list includes everything else on the form, including Checkbox1, but not Checkbox2.
 
oops - forgot to add,

The code is all on Userform1. I tried deleting the control and adding it again.

Didn't work.
 
I saw something that sounds a bit like this once before in VB6 where someone had created a control array rather than a completely seperate control. It was done by accident.

Unfortunately I can't remember the definitive solution (or even how to recognise this is the problem) but in the properties box check to see that there is only 1 named object in the dropdown at the top. Do this for both check boxes.

This may be a wild goose chase but if it isn't you'll need someone better than me to tell you how to get out of the problem. If it is an array I think you need to delete all elements of the array, but....

;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Got it!

I had 3 radio buttons that were grouped. I added a fourth and forgot to include it in the group. Once I fixed that, the checkbox problem fixed itself.

Who knows why? I don't - but it works now.
 
I don't think you can create control arrays in VBA the same way as in VB. You must specify the Index property for each control and reference it in code as CheckBox1(index).

Try to force it. Just put the second CheckBox in there with properties etc.

What error message are you receiving?

D. "I want to play..."
(Guess the X-Files episode!)
 
This is a bug in VBE, as far as I can tell. I have the exact same thing happen to me all the time. New controls that I add to userforms typically don't get recognized by VBE until I remove (and export) the userform and then re-import it. Very annoying, but I haven't found a solution. Worse, sometimes if I don't go through the export-import procedure, the entire workbook gets corrupted. Needless to say, I've gotten careful about this.
It's interesting that the change in the radio button configuration cleared up the checkbox problem - there may be a clue in there as to what's going on...
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top