Public Function SchemaFile(bIncFldNames As Boolean) As Boolean 'Create a module and name it schema for example. 'Cut and paste this code into the module you just created. 'use the directions at the bottom for running the code 'Pay attention to the "spath" variable value so you know where the output file is put on your system. 'Disclaimer: We know that this is not the only or even perhaps the best way to accomplish the same thing 'But, it works for an example. If you have a better suggestion, please feel free to email us with your comments. Dim Msg As String ' For error handling. Dim spath As String, stblqryname As String On Local Error GoTo CreateSchemaFile_Err Dim ws As Workspace, db As DAO.Database Dim tbl As DAO.TableDef, fldDef As DAO.Field, tbldef As TableDef Dim i As Integer, Handle As Integer Dim fldName As String, fldDataInfo As String ' ----------------------------------------------- ' Set DAO objects. ' ----------------------------------------------- spath = "c:\temp\" Set db = CurrentDb() ' ----------------------------------------------- ' Open schema file for append. ' ----------------------------------------------- Handle = FreeFile Open spath & "schema.txt" For Output Access Write As #Handle Print #Handle, " Schema Listing for " & db.Name Print #Handle, " " Print #Handle, " Created on " & Now() ' ----------------------------------------------- ' Write schema header. ' ----------------------------------------------- stblqryname = " " ' ----------------------------------------------- ' Get data concerning schema file. ' ----------------------------------------------- For Each tbl In db.TableDefs stblqryname = tbl.Name Set tbldef = db.TableDefs(stblqryname) Print #Handle, " " Print #Handle, " Table"; Tab(40); "Created"; Tab(80); "Modified"; Tab(110); "#Recs"; Tab; "Attribute" Print #Handle, " ________________________________________________________________________________________" Print #Handle, " [" & stblqryname & "]"; Tab(40); tbl.DateCreated; Tab; tbl.LastUpdated; Tab; tbl.RecordCount; Tab; tbl.Attributes; Print #Handle, " " Print #Handle, " " For i = 0 To tbl.Fields.Count - 1 Set fldDef = tbl.Fields(i) With fldDef fldName = .Name Select Case .Type Case dbBoolean fldDataInfo = "Bit" Case dbByte fldDataInfo = "Byte" Case dbInteger fldDataInfo = "Short" Case dbLong fldDataInfo = "Integer" Case dbCurrency fldDataInfo = "Currency" Case dbSingle fldDataInfo = "Single" Case dbDouble fldDataInfo = "Double" Case dbDate fldDataInfo = "Date" Case dbText fldDataInfo = "Char Width " & Format$(.Size) Case dbLongBinary fldDataInfo = "OLE" Case dbMemo fldDataInfo = "LongChar" Case dbGUID fldDataInfo = "Char Width 16" End Select Print #Handle, " " & Format$(i + 1) _ & " = "; Tab(10); fldName; Tab(35); "----- "; fldDataInfo End With Next i Print #Handle, " " Next tbl Print #Handle, " " Print #Handle, " End Schema Listing " MsgBox spath & "SCHEMA.txt has been created." CreateSchemaFile = True CreateSchemaFile_End: Close Handle Exit Function CreateSchemaFile_Err: Msg = "Error #: " & Format$(Err.Number) & vbCrLf Msg = Msg & Err.Description MsgBox Msg Resume CreateSchemaFile_End End Function 'To test this function, type the following line in the Immediate window, and then press ENTER: 'Print SchemaFile(True)