J
James G via AccessMonster.com
Hi.....i have a temporary table......this table has 5 fields in it.....what
iam trying to do is export this table to my local hard drive as a .txt file...
....and each time that i click the button to export the table it will name the
txt file a differnt name according to my primary key........for instance......
...Primary Key = 234......txt file=000234...........this works fine......but
there is one problem.....how do i incorporate my export specifications with
my code below?....and also......how to i export the formats?.....because most
of the fields i am exporting will be currecy fields.....if you need any more
info let me know.....thanks...
Private Sub Command12_Click()
Dim rst As DAO.Recordset
Dim FolderName As String
Dim FileName As String
FolderName = "D:\Documents\eWorksheetForOSG\Export"
Set rst = CurrentDb.OpenRecordset("tOSG_Connect_Temp")
rst.MoveFirst
Do Until rst.EOF
FileName = FolderName & "\000" & rst.Fields(0) & ".txt"
Open FileName For Output As #1
Print #1, rst.Fields(0), rst.Fields(1), rst.Fields(2), rst.Fields(3), rst.
Fields(4)
Close #1
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
iam trying to do is export this table to my local hard drive as a .txt file...
....and each time that i click the button to export the table it will name the
txt file a differnt name according to my primary key........for instance......
...Primary Key = 234......txt file=000234...........this works fine......but
there is one problem.....how do i incorporate my export specifications with
my code below?....and also......how to i export the formats?.....because most
of the fields i am exporting will be currecy fields.....if you need any more
info let me know.....thanks...
Private Sub Command12_Click()
Dim rst As DAO.Recordset
Dim FolderName As String
Dim FileName As String
FolderName = "D:\Documents\eWorksheetForOSG\Export"
Set rst = CurrentDb.OpenRecordset("tOSG_Connect_Temp")
rst.MoveFirst
Do Until rst.EOF
FileName = FolderName & "\000" & rst.Fields(0) & ".txt"
Open FileName For Output As #1
Print #1, rst.Fields(0), rst.Fields(1), rst.Fields(2), rst.Fields(3), rst.
Fields(4)
Close #1
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub