fieldNames or control source problem

  • Thread starter Thread starter KRISH
  • Start date Start date
K

KRISH

Hi
I palced Text Box, Combo, CheckBox controls on form.
I want to get the names of the controls or control source
of the above controls at BeforeUpdate event of the form.

Kindly help if any one have the solution.
thanks
Krish
 
Loop through the Controls of the form, examining the Name and ControlSource
of each:

Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextbox, acComboBox, acCheckBox
Debug.Print ctl.Name, ctl.ControlSource
End Select
Next
Set ctl = Nothing

Note that this code will error if the check box is part of an option group:
in that case, the group has a ControlSource, but the check boxes do not.
 
Back
Top