Fields in the field list

  • Thread starter Thread starter KRISH
  • Start date Start date
K

KRISH

hi!

I want to know the names of fields in fieldlist of my
form. kindly help. how do it in vbcode.

thanks.
krish
 
KRISH said:
hi!

I want to know the names of fields in fieldlist of my
form. kindly help. how do it in vbcode.

At what point are you trying to do this, and why? I asume you're doing
it at run time, because otherwise you'd just look in design view, and I
guess you're doing it because the form's recordsource is being set
dynamically.

At any point at or after the form's Load event, you should be able to
use code like this to print the names of the fields in the form's
current recordsource:

' *** Note -- the following code assumes the form has a
' *** DAO recordset, which will be true if it's in an MDB,
' *** not an ADP, and its recordset hasn't been set manually
' *** to an ADODB recordset.

Dim fld As DAO.Field

For Each fld In Me.Recordset
Debug.Print fld.Name
Next fld

You haven't said what you want to do with the field names, so that's all
I can say at the moment.
 
Back
Top