Run-Time error '2342':

D

David Kennedy

Can anybody tell me why I am getting the error below
when I run the sqlQryMfr statement?
I`ve checked the statement in the immediate window and it looks ok.

Run-Time error '2342':
A RunSQL action requires an argument consisting of an SQL statement



sqlQryMfr = "SELECT DISTINCT " & TableName & ".Manufacturer FROM " & TableName & ";"

DoCmd.RunSQL sqlQryMfr

Thanks in advance
David K
 
L

Lynn Trapp

DoCmd.RunSQL will only work with Action Queries (Insert, Update, Delete). You can use DoCmd.OpenQuery for Select Queries.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Can anybody tell me why I am getting the error below
when I run the sqlQryMfr statement?
I`ve checked the statement in the immediate window and it looks ok.

Run-Time error '2342':
A RunSQL action requires an argument consisting of an SQL statement



sqlQryMfr = "SELECT DISTINCT " & TableName & ".Manufacturer FROM " & TableName & ";"

DoCmd.RunSQL sqlQryMfr

Thanks in advance
David K
 

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

VBA -- SQL 9
Run-time error '2342' 5
Problem with DoCMD.RUNSQL Select statement 7
RunSQL question 10
DoCmd.RunSQL HELP!!! I will not work! 1
Using Date fields in SQL 2
Running a SELECT statement 2
Stop Query 4

Top