cycle through controls to get value

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
 
C

Chadlon

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
 
Top