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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop through form controls 2

Status
Not open for further replies.

hirenJ

Programmer
Dec 17, 2001
72
GB

Hi All,

I am writing some code for a form that contains UnBound controls --

I need a bit of code that will loop through all the txtBoxes, combo's etc, and store their value as into a variable --

any ideas?

Thanks

Hiren

:eek:)
 
Hi Hiren!

Try this:

Dim cntl As Control

For Each cntl In Me.Controls
Select Case cntl.ControlType
Case acTextBox
Do your text box stuff here(check the name using cntl.Name)
Case acComboBox
Do your combo box stuff here
etc for acCheckBox or acRadioButton or acListBox
End Select
Next cntl

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top