Please help Me !!! I need immediate help

J

John Jackson

My documenter is not working in Access 97. I need to know
how can I (through code) list all linked and static tables
in my database along with their data elements. I want to
be able to create a report for this. Below is one example
of what I want, but I want it for all tables (linked and
static). Thanks


For example,

tbl_BookCheckOUt

Patron text
Numberofbooks number
branch text
branchID text
 
C

CGI

John,

The code below works in Access 97 - you'll have to adjust the objects to
have it work in ADO (or set a reference back to DAO).

HTH

Eric

-----------------------------------------------

Public Sub Documents()
Dim db As Database
Dim tbl As TableDef
Dim fld As Field
Dim stType As String

Set db = CurrentDb
Open "C:\My Documents\Listing.txt" For Output As #1 'Open a
listing file
Print #1, "Documentation for: " & db.Name
For Each tbl In db.TableDefs
'Loop through the tables
Print #1, vbCrLf
'Headers for each table-could make this fancier
Print #1, "Table: " & tbl.Name & vbCrLf
Print #1, "Field Name", "Type", vbCrLf
For Each fld In tbl.Fields
'Loop through the fields
Select Case fld.Type
'fld.type returns an integer-select case translates to description
Case dbBigInt
stType = "Big Integer"
Case dbBinary
stType = "Binary"
Case dbBoolean
stType = "Boolean"
Case dbByte
stType = "Byte"
Case dbChar
stType = "Char"
Case dbCurrency
stType = "Currency"
Case dbDate
stType = "Date / Time"
Case dbDecimal
stType = "Decimal"
Case dbDouble
stType = "Double"
Case dbFloat
stType = "Float"
Case dbGUID
stType = "Guid"
Case dbInteger
stType = "Integer"
Case dbLong
stType = "Long"
Case dbLongBinary
stType = "Long Binary (OLE Object)"
Case dbMemo
stType = "Memo"
Case dbNumeric
stType = "Numeric"
Case dbSingle
stType = "Single"
Case dbText
stType = "Text"
Case dbTime
stType = "Time"
Case dbTimeStamp
stType = "Time Stamp"
Case dbVarBinary
stType = "VarBinary"
End Select

Print #1, fld.Name, stType 'Wirte
field name and type to file
Next fld
Next tbl
Close #1
MsgBox "Done"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top