Recordset - Can you use a query?

G

Guest

I was hoping o ue a query qryOut as my recordsource for an output file. Is
this possible? Reason being that this query is based on another
query...trying to take the easy way out.

Dim db As Database
Set db = CurrentDb()

Dim rs As Recordset
Set rs = db.OpenRecordset("qryOut")

Close #1
Open "f:/fileout.txt" For Output As #1

Dim stOut As String

stOut = "CH " & Trim$(rs.Fields("AcctNum")) & " " &
Format$(rs.Fields("Date"), "mmddyy")

Print #1, stOut
End Sub
 
G

Guest

My query is "qryOut" and this code is not working. Are you saying that I
need to actually have the select statement here instead of the query name?
I've done this type of thing using a select statement, but as I mentioned
qryOut is based on 2 other queries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top