ListFields Method Example

This example creates a Snapshot listing all of the fields in the Publishers table of the BIBLIO.MDB database, then prints the data in the active form.

 

Dim ListSet As Snapshot, MyDB As Database, MyTable As Table
Set MyDB = OpenDatabase("BIBLIO.MDB")
Set MyTable = MyDB.OpenTable("Publishers")  ' Open Table.
Set ListSet = MyTable.ListFields()          ' Put field info in ListSet.
MyTable.Close                               ' Close Table.
Do While Not ListSet.EOF
  Print ListSet("Name")
  Print ListSet("Type")
  Print ListSet("Size")
  Print ListSet("Attributes")
  Print ListSet("SourceTable")
  Print ListSet("SourceField")
  ListSet.MoveNext
Loop

ListSet might look like the following table.

 

Name               Type   Size   Attributes  SourceTable     SourceField

 

PubID          4    4     33    Publishers   PubID
Name          10   50     32    Publishers   Name
Company Name  10  255     32    Publishers   Company Name
Address       10   50     32    Publishers   Address
City          10   20     32    Publishers   City
State         10   15     32    Publishers   State
Zip Code      10   10     32    Publishers   Zip Code
Telephone     10   24     32    Publishers   Telephone
Fax           10   24     32    Publishers   Fax