DoCmd.RunSQL error 2 
Author Message
 DoCmd.RunSQL error 2

My plan is to store the information in variables, display
the information in text boxes for the users review then
later (in the same screen) write the information to the
proper table.

Thanks for the information regarding the difference in a
action vs. non-action query. I think I may have an idea
but any suggestion you have would be greatly appreciated.

Thanks, JR

Quote:
>-----Original Message-----
>The DoCmd.RunSQL command does not work for non-action

queries. You're trying
Quote:
>to use it to run a "select" query, which is a non-action
query. ("Action"
>queries are "append", "delete", "make-table", etc. type
of queries.)

>What are you wanting to do with the results of the query?
That info is
>needed in order to give you some suggestions.

>--
>       Ken Snell
><MS ACCESS MVP>



>> When attempting to run the following code (event from a
>> combobox) I get the following error:
>> "A RunSQL action requires an argument consisting of an
SQL
>> statement." Run-time error 2342

>> Private Sub cboDeptStrategy_AfterUpdate()

>> On Error GoTo EH

>> 'after the user selects a dept. strategy in the dropdown
>> box
>> 'this code will run to collect all the other information
>> related
>> 'to the dept. strategy. Currently will not recognize the
>> sql statement.

>> Dim stSQL As String 'variable for sql statement

>> 'sql statement to select everything from the table with
>> the dept. strategy.
>> stSQL = "Select * From dbo_tblDeptStrategy;"

>> 'run the sql statement
>> DoCmd.RunSQL stSQL

>> Exit_eh:
>>     Exit Sub

>> EH:
>>     MsgBox Err.Description & Err.Number
>>     Resume Exit_eh

>> End Sub

>> any help would be greatly appreciated.
>> Thanks, JR



Tue, 06 Dec 2005 00:52:51 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. DoCmd.RunSQL Error

2. error 2342 with docmd.runsql

3. DoCmd.RunSQL

4. docmd.RunSql problem

5. docmd.RunSQL String Concatenation

6. DoCmd.RunSQL too long record

7. DoCmd.RunSQL

8. suppress warnings on DoCmd.RunSQL ?

9. docmd.runsql repeat problem

10. docmd.runsql help required

11. DoCmd.RunSQL vs. Recordsets

12. docmd.runSQL fails on Windows 2000

 

 
Powered by phpBB® Forum Software