How to close a query result?

H

homer

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
 
O

Ofer

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
 
R

Rick Brandt

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.
 
Top