By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,316 Members | 2,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,316 IT Pros & Developers. It's quick & easy.

Listing fields in a table

P: 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!
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 26 Oct 2005 06:10:27 +0100, JohnM wrote:
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!


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
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.