how to run a SQL select statement and display in a new datasheet

J

Jerry Qu

Hi All,

how can I run a SQL select statement using VBA and display the result to a
new datasheet just like
Docmd.opentable and docmd.openQuery doing. the docmd.runsql only works for
action statement.

Please help

TIA

Jerry
 
A

Allen Browne

Could you create a query for this purpose, and then:
strSql = "SELECT ...
CurrentDb().QueryDefs("Query1").SQL = strSql
DoCmd.OpenQuery "Query1"
 

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