How to close a query result?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After docmd.openQuery opens a select query, what is the syntax to close it?
Actually I don't need to see the result of it. Is there a way to make it not
show?

Set qdf = db.QueryDefs("qryInvoice")
strSQL="Select ..... where ID ='" & txtID & "'"
qdf.SQL = strSQL
DoCmd.OpenQuery stDocName, acNormal, acEdit
????
DoCmd.OpenReport stDocName, acPreview
 
Try
docmd.Close acQuery,"QueryName"

I'm trying to understand what is the purpose of openning a select query and
closing it.
Just open the report without openning the query
 
homer said:
After docmd.openQuery opens a select query, what is the syntax to
close it? Actually I don't need to see the result of it. Is there a
way to make it not show?

Set qdf = db.QueryDefs("qryInvoice")
strSQL="Select ..... where ID ='" & txtID & "'"
qdf.SQL = strSQL
DoCmd.OpenQuery stDocName, acNormal, acEdit
????
DoCmd.OpenReport stDocName, acPreview

If you don't need to see it why are you opening it? "Opening" a SELECT
query doesn't accomplish anything other than to make the datasheet appear on
the screen.
 
Back
Top