execute query

G

Guest

With the following code, i would like to execute a select query. Prior to
this line I have defined strSourceQuery and the syntax looks fine. If I open
qryDataSource from the query tab, it runs fine. But I get an error "can't
execute query" when I try to run the code. Any suggestions?

With CurrentDb.QueryDefs("qryDataSource")
.SQL = strSourceQuery
.Execute
End With

Thanks!!
 
G

Guest

To open a select query use

docmd.OpenQuery "QueryName"

You execute update/append/delete queries
 
G

Guest

Thanks, Ofer! I figured it was pretty basic. I've not run queries
programmatically before. Hope you live long and prosper, too.
 

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