G
Guest
After reviewing some previous posting on this, I tried using the following
code:
Private Sub Command17_Click()
Dim rsR As DAO.Recordset
Dim strline As String
Dim lngFN As Long
'Create empty text file
lngFN = FreeFile()
Open "C:\Documents and Settings\mjray\Desktop\mpedata.txt" For Output As
#lngFN
'Output Header
Print #lngFN, "(e-mail address removed)"
'Output ZipCodes
Set rsR = CurrentDb.OpenRecordset("AllZips")
While rsR.EOF <> True
Debug.Print rsR.Fields
Print #lngFN, rsR.Fields
Wend
'Close rsR
Close rsR
'Output EOF
Print #lngFN, "EOF"
Close #lngFN
End Sub
I wrote a query that just returns zip codes. I defined a specification file
which removes the quotes when the zip codes are exported. I need to add an
email address to the very first line of the text file and the EOF indicator
at the very last line of the text file. I can only seem to export the very
first record from teh recordset. I can't seem to export all of the records.
Thanks,
Mike
code:
Private Sub Command17_Click()
Dim rsR As DAO.Recordset
Dim strline As String
Dim lngFN As Long
'Create empty text file
lngFN = FreeFile()
Open "C:\Documents and Settings\mjray\Desktop\mpedata.txt" For Output As
#lngFN
'Output Header
Print #lngFN, "(e-mail address removed)"
'Output ZipCodes
Set rsR = CurrentDb.OpenRecordset("AllZips")
While rsR.EOF <> True
Debug.Print rsR.Fields
Print #lngFN, rsR.Fields
Wend
'Close rsR
Close rsR
'Output EOF
Print #lngFN, "EOF"
Close #lngFN
End Sub
I wrote a query that just returns zip codes. I defined a specification file
which removes the quotes when the zip codes are exported. I need to add an
email address to the very first line of the text file and the EOF indicator
at the very last line of the text file. I can only seem to export the very
first record from teh recordset. I can't seem to export all of the records.
Thanks,
Mike