Martin Reid
mwp.reid at qub.ac.uk
Sat Dec 30 12:59:05 CST 2006
Just fixing some stuff up. ANyone any idea whats the problem with this. It fails as soon as it tried to export the tables.
Martin
Public Sub createtemplate()
Dim db As Database
Dim doc As Document
Dim conn As Container
Dim strPath As String
Dim I As Integer
Set db = CurrentDb()
strPath = "C:\forms\"
'Export the forms
Set conn = db.Containers("Forms")
For Each doc In conn.Documents
Application.SaveAsText acForm, doc.Name, strPath & "Form_" & doc.Name & ".txt "
Next doc
'Export the Rreports
Set conn = db.Containers("Reports")
For Each doc In conn.Documents
Application.SaveAsText acReport, doc.Name, strPath & "Report_" & doc.Name & ".txt"
Next doc
Set conn = db.Containers("Modules")
For Each doc In conn.Documents
Application.SaveAsText acModule, doc.Name, strPath & "Module_" & doc.Name & ".txt"
Next doc
For Each td In db.TableDefs
If Left(td.Name, 4) <> "MSys" Then
DoCmd.TransferText , acExportDelim, , tb.Name, strPath & "Table " & td.Name & "text", True
End If
Next td
For I = 0 To dbs.QueryDefs.Count - 1
Application.SaveAsText acQuery, dbs.QueryDefs(I).Name, "strPath" & dbs.QueryDefs(I).Name & ".txt"
Next I
Set db = Nothing
Set conn = Nothing
Set doc = Nothing
Exit_createtemplate:
Exit Sub
End Sub
Martin WP Reid
Training and Assessment Unit
Riddle Hall
Belfast
tel: 02890 974477