Running a SELECT statement

G

Guest

When I try to run the following
DoCmd.RunSQL "Select tblTest.* From tblTest"
I get an error 2342 A RunSQL Action requires an argument consistent with an
SQL statement. What am I missing
 
K

Ken Snell \(MVP\)

DoCmd.RunSQL will only run action queries. Your SQL statement is a select
query, therefore it doesn't work.

If you want to display the datasheet view from the query, try
DoCmd.OpenQuery method.
 

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

Similar Threads

Using Date fields in SQL 2
SQL Query in VBA 9
Stop Query 4
Select sum() query 3
SQL statement doesn't work in VBA. 2
SQL -- VBA 3
VBA -- SQL 9
VBA query trouble 3

Top