Running a SELECT statement

J

JoeA2006

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 -- VBA 3
SQL Query in VBA 9
Stop Query 4
VBA query trouble 4
SQL statement doesn't work in VBA. 4
VBA -- SQL 9
Record source - "No fields available to be added to the current vi 1

Top