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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Specification Export

Status
Not open for further replies.

eblattner

Programmer
Aug 10, 2000
33
Hello, I need to export the specifications only that someone else created in a database so I can use the data in a vb project. I need the specifications only, not the data. I will write the code to import the file (a fixed width .txt file with about 50 fields). I can import the file in access using the existing specs. but it would be VERY helpfull in writing the code if I could copy and paste the field names and lengths from the specs. I know the specs. were created in Access, but I see no way of exporting them to a txt file. Thanks for any suggestions!
 
Docmd.TransferText acExportDelim,"","Employee","C:\tmp\1.txt",true

The above may be used to export data

Or Try the below modules

Option Compare Database
Option Explicit

Public Function DocumentTable(xTable As String)
Dim tdf As TableDef
Dim db As Database
Dim strDocument As String
Dim fld As Field
Set db = CurrentDb
Set tdf = db.TableDefs(xTable)
strDocument = "Table : " & PadSpace(xTable, 50) & vbCrLf
For Each fld In tdf.Fields
strDocument = strDocument & PadSpace(fld.Name, 30)
If fld.Type = dbLong Or fld.Type = dbInteger Or fld.Type = dbByte Or fld.Type = dbSingle Or fld.Type = dbDouble Or fld.Type = dbDecimal Then
strDocument = strDocument & vbTab & PadSpace("Number", 15)
ElseIf fld.Type = dbCurrency Then
strDocument = strDocument & vbTab & PadSpace("Money", 15)
ElseIf fld.Type = dbDate Then
strDocument = strDocument & vbTab & PadSpace("Date/Time", 15)
ElseIf fld.Type = dbBoolean Then
strDocument = strDocument & vbTab & PadSpace("Boolean(Yes/No)", 15)
ElseIf fld.Type = dbText Then
strDocument = strDocument & vbTab & PadSpace("Text(" & fld.Size & ")", 15)
ElseIf fld.Type = dbMemo Then
strDocument = strDocument & vbTab & PadSpace("Memo", 15)
Else
strDocument = strDocument & vbTab & PadSpace("Unknown", 15)
End If
strDocument = strDocument & vbCrLf
Open "C:\tmp\1.txt" For Output As #1
Print #1, strDocument
Close #1
Next fld

End Function
Private Function PadSpace(xStr As String, xLen As Integer) As String
Dim xOut As String
xOut = xStr & Space(xLen - Len(xStr) + 1)
PadSpace = xOut
End Function




Call as DocumentTable "Employee"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top