itemize recordset column info?

  • Thread starter Thread starter Frank B
  • Start date Start date
F

Frank B

In code I have opened a recordset that is the result of an
SQL query on multiple tables. In code I would like to
extract the column name and related table information for
each column. Can I do this in code? I would like to know
all the column names, and the underlying table name for
each column in the recordset. Also, if the column name
has an Alias, can I find the real name? Are there any
other column properties available? Is this possible?
Thanks for any code, ideas, or guidance...

Sincerely,
Frank
 
Frank B said:
In code I have opened a recordset that is the result of an
SQL query on multiple tables. In code I would like to
extract the column name and related table information for
each column. Can I do this in code? I would like to know
all the column names, and the underlying table name for
each column in the recordset. Also, if the column name
has an Alias, can I find the real name? Are there any
other column properties available? Is this possible?
Thanks for any code, ideas, or guidance...

Sincerely,
Frank

Off the top of my head I can't give you every option avialable but the Field
object in help should get you started. Here is a short example

I always use DAO so it's included in my code.

Dim TheDB as Dao.Database, TheRecordset as Dao.Recordset, TheField as
DAO.Field
Dim strSQL as string

Set TheDB = CurrentDB()
strSQL = "Your SQL Statement Here"
Set TheRecordset = TheDB.OpenRecordset(strSQL)
For Each TheField in TheRecordset.Fields
Debug.Print TheField.Name
Next

The field object has many properties and although I can't remember it, there
is one about the underlying table name and alias names.
hth,
 
Jeff:

Thanks for the great reply. I checked out the Fields
object, and (at first) it seemed all ADO, but digging
around a bit, I did find the DAO info. There appear to be
about 18 options which I need to study. You really got me
on the right track....

Again, thank you,
Frank
 
Back
Top