Using With on multiple controls

M

mcalex

Hi all

If i want to do the same thing to a bunch of controls, can i wrap multiple
'With' statements around the control manipulation code as below:

With combo1
With listBox1
With listBox2
.RowSource = ""
.Requery
End With
End With

or do i have to write a 'clear data' method and pass all the controls to it?
 
A

Andy Pope

Hi,

The second option.

Using the nested With's only applies the setting to the inner most control.

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top