How to close a query result?

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
 
G

Guest

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.
 

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