returning all field names on a form

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!!!
 
W

William Taylor

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
 
T

TC

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
 

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