Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 03:57 PM
JohnM
Guest
 
Posts: n/a
Default Listing fields in a table

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
Default 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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles