K
Ken Chan
Thanks Marv.
I tried writing the script below, but realize that
WRITELINE cannot write data if it contains “?” because of
Chinese characters. Is it right? That means I need to use
Word. Can anyone give me a suggestion? Is there a
mistakes??
Dim dat As Variant
Dim RM As ADODB.Recordset
Set RM = New ADODB.Recordset
RM.ActiveConnection = CurrentProject.Connection
RM.CursorType = adOpenKeyset
RM.LockType = adLockOptimistic
'Open Query
RM.Open "MYOBInvoice", , , , adCmdTable
Dim fs As Object
Dim strTxtLine, strTempFileName As String
'text command-------------------
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("d:\testfile.txt", True)
a.WriteLine ("CoName Invoice# Date
CustomerPO Item_Number Total Inc-Tax_Total")
While Not RM.EOF
dat = RM.Fields(1)
If Not RM.Fields(0) = dat Then
a.WriteLine Chr(13)
a.WriteLine RM.Fields(0) & Chr(32) & RM.Fields
(1) & Chr(32)
Else
a.WriteLine RM.Fields(0) & Chr(32) & RM.Fields
(1) & Chr(32)
End If
RM.MoveNext
Wend
MsgBox ("Done")
a.Close
I tried writing the script below, but realize that
WRITELINE cannot write data if it contains “?” because of
Chinese characters. Is it right? That means I need to use
Word. Can anyone give me a suggestion? Is there a
mistakes??
Dim dat As Variant
Dim RM As ADODB.Recordset
Set RM = New ADODB.Recordset
RM.ActiveConnection = CurrentProject.Connection
RM.CursorType = adOpenKeyset
RM.LockType = adLockOptimistic
'Open Query
RM.Open "MYOBInvoice", , , , adCmdTable
Dim fs As Object
Dim strTxtLine, strTempFileName As String
'text command-------------------
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("d:\testfile.txt", True)
a.WriteLine ("CoName Invoice# Date
CustomerPO Item_Number Total Inc-Tax_Total")
While Not RM.EOF
dat = RM.Fields(1)
If Not RM.Fields(0) = dat Then
a.WriteLine Chr(13)
a.WriteLine RM.Fields(0) & Chr(32) & RM.Fields
(1) & Chr(32)
Else
a.WriteLine RM.Fields(0) & Chr(32) & RM.Fields
(1) & Chr(32)
End If
RM.MoveNext
Wend
MsgBox ("Done")
a.Close