Field name list

G

Guest

In my last post, I described needing 'to create a list of field names in a
table' actually, I need to 'print a list of field names from two tables'.
Please advise.
 
A

Albert D.Kallal

Mike said:
In my last post, I described needing 'to create a list of field names in a
table' actually, I need to 'print a list of field names from two tables'.
Please advise.

Yes.., the documenter will do this for you....

Play with the options...if you un-check a few...your printout will be
columnar......
 
D

Danny J. Lesandrini

The documentor will give you more than you probably need. If you just
want the field list, then try this ...


Function FooFields(ByVal strTable As String) As String

Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim strOut As String

Set dbs = CurrentDb
Set tdf = dbs.TableDefs(strTable)
For Each fld In tdf.Fields
strOut = strOut & fld.Name & vbCrLf
Next
Set tdf = Nothing
Set dbs = Nothing
FooFields = strOut

End Function

Run it from the Immediate window with this line ...

?FooFields("tblYourTableNameHere")
 
D

Duane Hookom

Actually, the easiest method of pulling just the field names, is to create a
report with no record source. Add two tall list boxes to the detail section
of the report. Set their Row Source Type property to "Field List" and their
Row Source properties to your table names.
 
D

Danny J. Lesandrini

I always wondered what that option was for, but how do you get it from there to Excel?
 
D

Duane Hookom

I didn't understand there was a requirement to get the list to Excel. Maybe
print screen and paste it into Excel :)

--
Duane Hookom
MS Access MVP
--

Danny J. Lesandrini said:
I always wondered what that option was for, but how do you get it from
there to Excel?
 

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