Connecting Tech Pros Worldwide Help | Site Map

Listing fields in a table

  #1  
Old November 13th, 2005, 03:57 PM
JohnM
Guest
 
Posts: n/a
Thanks for the replies regarding adding fields on the fly. .. I'm now
managing that. I can't seem to do something that ought to be more simple,
that is to give the user a list of current fields in a table!


  #2  
Old November 13th, 2005, 03:57 PM
fredg
Guest
 
Posts: n/a

re: Listing fields in a table


On Wed, 26 Oct 2005 06:10:27 +0100, JohnM wrote:
[color=blue]
> Thanks for the replies regarding adding fields on the fly. .. I'm now
> managing that. I can't seem to do something that ought to be more simple,
> that is to give the user a list of current fields in a table![/color]

You can either
1) Set the RowSource type of a combo box to Field List.
Set the RowSource to the name of the table.

or ....

2) Paste the following into a Module

Public Sub GetFieldNames()
Dim dbs As Database, tdf As TableDef, fld As Field
' Return reference to current database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If Left(tdf.Name, 4) <> "MSYS" Then
Debug.Print tdf.Name
For Each fld In tdf.Fields
Debug.Print " " & fld.Name
Next fld
End If
Next tdf

Set dbs = Nothing
End Sub

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display flag if record exists in table dmorand answers 2 May 12th, 2009 06:52 PM
Populating fields in another form via checkbox selection wideasleep answers 12 May 31st, 2007 04:36 PM
too many fields in report shawnews answers 3 November 12th, 2006 11:25 PM
Controls in HeaderTemplate Yan Wang answers 6 November 18th, 2005 09:44 AM