cycle through controls to get value

  • Thread starter Thread starter tim johnson
  • Start date Start date
T

tim johnson

I am trying to cylce through certain controls on a form
to get their value but it seems ctl.Value is incorrect.
What is the cortrect statement?

Thanks

Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acOptionGroup, acComboBox
MsgBox ctl.Value
End Select
Next ctl
 
Are you having trouble with Null values?

Try
MsgBox Nz(ctl.Value)

Or, instead of the MsgBox command, try
Debug.Print ctl.Name, ctl.Value
 
Back
Top