Recordset - Can you use a query?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top