returning all field names on a form

  • Thread starter Thread starter tracey
  • Start date Start date
T

tracey

I was trying to us the "For Each" method to return values
and field names for each field on a form. I had no
success. I looked at the example in the help file and I
don't understand. I'm sure that it is simple, I'm just
stuck. Thanks for any help!!!
 
fields belong to the recordset collection
forms have controls
but here is code to loop thru all underlying fields of the recordset and
return there name and value
Dim fld As Object
For Each fld In Me.Recordset.Fields
Debug.Print fld.Name & " " & fld.Value
Next fld
 
I think she wants the form controls, not the recordset fields.

dim ctl as control
for each ctl in me.controls
msgbox ctl.name
next

HTH,
TC
 
Back
Top