|
-
Dec 23rd, 2005, 01:15 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] export form records with filters to a text file
Hey everyone,
I'm trying to export an access form records to a text file with a certain structure.
Thing is I can't get it to consider the current form filter. When I use my code it exports all the form records no matter what the filter is.
here's my code:
----------------------------------------------
Private Sub create_txt_file_Click()
Dim rs As DAO.Recordset
Dim StrQryName As String
Dim OutFile As String
StrQryName = "My_Forms_Query"
OutFile = "g:\My_Form_Records.txt"
Open OutFile For Output As #1
Set rs = CurrentDb.OpenRecordset(StrQryName)
If Me.FilterOn = True Then rs.filter = Me.filter
rs.OpenRecordset
rs.MoveFirst
Do Until rs.EOF
Print #1, rs("field_1") & " " & rs("field_2")
rs.MoveNext
Loop
rs.Close
Close #1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|