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
 

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