Martin Reid
mwp.reid at qub.ac.uk
Sat Dec 30 14:38:25 CST 2006
You think i of all people would check typos first! I do its and cut and paste into email. Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: accessd-bounces at databaseadvisors.com on behalf of Gustav Brock Sent: Sat 30/12/2006 19:54 To: accessd at databaseadvisors.com Subject: Re: [AccessD] Save as Text Hi Martin Correct your typo: DoCmd.TransferText , acExportDelim, , td.Name, strPath & "Table " & td.Name & "text", True Don't you use Option Explicit? Highly recommended! /gustav >>> mwp.reid at qub.ac.uk 30-12-2006 19:59 >>> 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com <http://www.databaseadvisors.com/>