Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting table names and structures

Status
Not open for further replies.

edrest

Programmer
Apr 22, 2000
73
US
Is there a way in DAO and/or ADO to get the names of the tables in an Access Database?

Is there also a way to get the structure of the table...ie field names, field types, and field length?

Thanks for any help. [sig]<p>Tom Gahagan<br><a href=mailto:edrest@alltel.net>edrest@alltel.net</a><br><a href= > </a><br>REST<br>
<br>
If you get a chance to sit out or dance...<br>
I hope you dance. L Wommack[/sig]
 
Try this.

Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection

Set conn = New ADODB.Connection

conn.Open &quot;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=JamaicanHomes;Data Source=PROGANLST&quot;

Set rs = conn.OpenSchema(adSchemaTables)

Do Until rs!TABLE_NAME = &quot;Properties&quot;
sCurrentTable = rs!TABLE_NAME
rs.MoveNext
Loop

Set rs = conn.OpenSchema(adSchemaColumns)
sColumnName = rs!COLUMN_NAME

End Sub

Delton
dphilips@gleanerjm.com
[sig][/sig]
 
Tom Gahagan,

The above may work - if you replace the 'smiley' w/ &quot;L&quot; and delete the following &quot;E&quot;.

An easier method - If you have Ms. Access (and Who doesn't?). Open the db in Ms. Access.

On the menu bar, click:
[tab]Tools
[tab][tab]Analyze
[tab][tab][tab]Documentor

in the popup 'menu' which appears, select the object type (Tables) and check each of the objects you are interested in.

There is an Options button to select some properties to print/preview.

Should get what you wnat.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
Thanks Michel and Delton (I think? < s >)

While I do have access... I have to do this particular bit of work in program code. I do, however, apprecaite the tip and the smiley face correction! < vbg >
[sig]<p>Tom Gahagan<br><a href=mailto:edrest@alltel.net>edrest@alltel.net</a><br><a href= > </a><br>REST<br>
<br>
If you get a chance to sit out or dance...<br>
I hope you dance. L Wommack[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top