MLS:
I've never liked the Documenter that much--tons of paper and the results aren't that great. Here's a routine (second routine to show field data types is called) that will create a table with your tabledefs. Each time you run it, it will expunge the existing temp table and create a new one so that any changes will be reflected (the error of trying to DROP a non-existent table is handled). Just to be a show-off I've included a simple routine that will drop all of your query object SQL into the debug window--just copy results to the clipboard, and drop them in Notepad.
HINT: Query the resulting table and create a report that shows this info. I like this much better than the documenter. You can play with this as needed--learn the DAO object model and you'll be rewarded with a wealth of info (it's friendlier than the ADOX catalog object).
[tt]
Public Function ShowTableDefs() As Boolean
On Error GoTo Err_ShowTableDefs
Dim db As DAO.Database
Dim Rst As DAO.Recordset
Dim Tdf As DAO.TableDef
Dim Fld As DAO.Field
Dim strDbName As String, strTblName As String, strFldName As String
Dim strSQL As String
'Delete existing copy of table
strSQL = "DROP TABLE TableDefs;"
DoCmd.RunSQL strSQL
strSQL = "CREATE TABLE TableDefs"
strSQL = strSQL & " (TableName TEXT(30), FieldName TEXT(30), FieldData TEXT(15),"
strSQL = strSQL & "FieldSize TEXT(5), DefaultValue TEXT(30), IsPrimary TEXT(10),"
strSQL = strSQL & "IsRequired TEXT(20));"
DoCmd.RunSQL strSQL
Set db = CurrentDb()
Set Rst = db.OpenRecordset("TableDefs"
With Rst
For Each Tdf In db.TableDefs
If Left(Tdf.Name, 4) <> "Msys" Then
For Each Fld In Tdf.Fields
.AddNew
!TableName = Tdf.Name
!FieldName = Fld.Name
!FieldData = FieldType(Fld.Type)
!FieldSize = Fld.Size
!DefaultValue = Fld.DefaultValue
If Fld.Required Then
!IsRequired = "Required"
End If
.Update
Next
End If
Next
.Close
End With
ShowTableDefs = True
Exit_Err_ShowTableDefs:
Set Tdf = Nothing
Set Rst = Nothing
Set db = Nothing
Exit Function
Err_ShowTableDefs:
Select Case Err.Number
'The error if table doesn't exist already
Case 3371
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Err_ShowTableDefs
End Select
End Function
Public Function FieldType(v_fldtype As Integer) As String
Select Case v_fldtype
Case dbBoolean
FieldType = "Boolean"
Case dbByte
FieldType = "Byte"
Case dbInteger
FieldType = "Integer"
Case dbLong
FieldType = "Long"
Case dbCurrency
FieldType = "Currency"
Case dbSingle
FieldType = "Single"
Case dbDouble
FieldType = "Double"
Case dbDate
FieldType = "Date"
Case dbText
FieldType = "Text"
Case dbLongBinary
FieldType = "LongBinary"
Case dbMemo
FieldType = "Memo"
Case dbGUID
FieldType = "GUID"
End Select
End Function
Private Sub ShowQueryDefs()
On Error GoTo Error_ShowQueryDefs
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb
For Each qdf In db.QueryDefs
Debug.Print qdf.Name & vbCrLf & vbCrLf & qdf.SQL & vbCrLf & vbCrLf
Next
Exit_Error_ShowQueryDefs:
Set qdf = Nothing
Set db = Nothing
Exit Sub
Error_ShowQueryDefs:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Error_ShowQueryDefs
End Sub
[/tt]