Access Runtime Error 2342
Contents |
Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rating: Display Modes 02-24-2008, 05:51 access runtime error 7874 PM #1 doco Power User Join Date: Feb 2007 Location: E.Oregon, run time error 2342 USA Posts: 467 Thanks: 19 Thanked 4 Times in 3 Posts ERROR 2342 DoCmd.RunSQL Quote: Example The following example updates the
Runtime Error 7874
Employees table, changing each sales manager's title to Regional Sales Manager: Public Sub DoSQL() Dim SQL As String SQL = "UPDATE Employees " & _ "SET Employees.Title = 'Regional Sales Manager' " & _ "WHERE Employees.Title
Run A Select Query In Vba Access
= 'Sales Manager'" DoCmd.RunSQL SQL End Sub Yet no manner of SQL statement is accepted without error. The following example is an oversimplification to make a point. Code: DoCmd.RunSQL "Select * from dbo_property" ' or even populating a variable SQL = "Select * from dbo_property" DoCmd.RunSQL SQL ' throws same error Throws Run Time error '2342' : "A RunSQL action requires an argument consisting of an SQL statement" Even copy and a runsql action requires an argument consisting of an sql statement paste SQL directly from Access QBE SQL editor of a query that does indeed work without error, throws the same error. Any ideas? TIA __________________ Consensus is the lack of leadership doco View Public Profile Visit doco's homepage! Find More Posts by doco 02-24-2008, 07:01 PM #2 ajetrumpet Banned Join Date: Jun 2007 Location: Universe - Local Group - Milky Way Galaxy - Orion Arm Posts: 5,640 Thanks: 0 Thanked 94 Times in 43 Posts Quote: Originally Posted by doco Any ideas? Yes, you are violating a very simple rule in Visual Basic: Action commands in Visual Basic can only carry out actions. This includes queries, or SQL statements that represent queries. The reason you are getting the error is probably because the SQL statement you are dealing with does not constitute an action. Action queries are: UPDATE, DELETE, APPEND, and MAKE TABLE. These are the only ones that can be used in Visual Basic with the Docmd.RunSQL and CurrentDB.Execute commands. ajetrumpet View Public Profile Visit ajetrumpet's homepage! Find More Posts by ajetrumpet 02-24-2008, 07:37 PM #3 Moniker VBA Pro Join Date: Dec 2006 Location: Dallas Posts: 1,567 Thanks: 0 Thanked 9 Times in 8 Posts And th
Property List (VBA) Access Function List (VBA) Access Method List (VBA) Word Project SPSS About Contact
Select Query In Access Vba
Me Access VBA DoCmd.RunSQL Method and Error 2342 Posted on March openrecordset access 6, 2015March 6, 2015 by Wyman W This tutorial explains how to use Access VBA DoCmd.RunSQL select statement in vba Method command and cause of Error 2342 (due to using non-action query such as Select statement) Access VBA DoCmd.RunSQL Method and Error 2342 DoCmd.RunSQL Method runs http://www.access-programmers.co.uk/forums/showthread.php?t=144266 specified SQL statement. The SQL statement can only be action query (such as create table, modifying data), but not Select statement. Syntax of DoCmd.RunSQL Method DoCmd.RunSQL(SQLStatement, UseTransaction) SQLStatement A string expression that's a valid SQL statement for an action query or a data-definition query. It uses an INSERT INTO, DELETE, SELECT…INTO, UPDATE, http://access-excel.tips/access-docmd-runsql-error-2342/ CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX, or DROP INDEX statement. Include an IN clause if you want to access another database. UseTransaction Use True (–1) to include this query in a transaction. Use False (0) if you don't want to use a transaction. If you leave this argument blank, the default (True) is assumed. Example of DoCmd.RunSQL Method The below example updates Employee ID from 001 to 010 Public Sub updateSQL() DoCmd.SetWarnings False strSQL = "UPDATE [Schedule_Table] SET [Empl ID] = '010' WHERE [Empl ID]='001'" DoCmd.RunSQL strSQL DoCmd.SetWarnings True End Sub DoCmd.SetWarnings False Method is used to disable the warning message. Cause of Error 2342 using DoCmd.RunSQL Method The below Select statement will cause Run-time error ‘2342', because DoCmd.RunSQL Method only supports action query. Public Sub selectSQL() strSQL = "Select * FROM [Schedule_Table] WHERE [Empl ID]='001'" DoCmd.RunSQL strSQL End Sub The error message "Run-time error ‘2342': A RunSQ
DriverDoc WinSweeper SupersonicPC FileViewPro About Support Contact Errors Troubleshooting › Runtime Errors › Microsoft Corporation › Microsoft Access › Error 2342 How http://www.solvusoft.com/en/errors/runtime-errors/microsoft-corporation/microsoft-access/2342-a-runsql-action-requires-an-argument-consisting-of-an-sql-statement/ To Fix Microsoft Access Error 2342 Error Number: Error 2342 Error Name:A RunSQL action requires an argument consisting of an SQL statement Error Description: https://www.experts-exchange.com/questions/21774969/Why-do-I-get-a-Run-time-error-'2342'-A-RunSQL-action-requires-an-argument-consisting-of-a-SQL-statement.html A RunSQL action requires an argument consisting of an SQL statement.@For example, an action query that appends records starts with INSERT INTO. A data-definition time error query that creates a table starts with CREATE TABLE.@@1@1@3698@1. Developer:Microsoft Corporation Software:Microsoft Access Applies to:Windows XP, Vista, 7, 8 Download NowWinThruster 2015 - Scan your PC for computer errors. Compatible with Windows 10, 8, 7, Vista, XP and 2000 Symptoms of Error 2342 "Error 2342" appears and crashes the access runtime error active program window. Your PC frequently crashes with Error 2342 when running the same program. “A RunSQL action requires an argument consisting of an SQL statement” is displayed. Windows runs sluggishly and responds slowly to mouse or keyboard input. Your computer periodically “freezes” for a few seconds at a time. These 2342 error messages can appear during program installation, while a Microsoft Corporation-related software program (eg. Microsoft Access) is running, during Windows startup or shutdown, or even during the installation of the Windows operating system. Keeping track of when and where your 2342 error occurs is a critical piece of information in troubleshooting the problem. Causes of Error 2342 Corrupt download or incomplete installation of Microsoft Access software. Corruption in Windows registry from a recent Microsoft Access-related software change (install or uninstall). Virus or malware infection that has corrupted Windows system files or Microsoft Access
Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Why do I get a Run time error '2342' A RunSQL action requires an argument consisting of a SQL statement ? Want to Advertise Here? Solved Why do I get a Run time error '2342' A RunSQL action requires an argument consisting of a SQL statement ? Posted on 2006-03-15 MS Access 1 Verified Solution 12 Comments 1,773 Views Last Modified: 2011-04-09 Why does the following SQL statement work fine in the form load: str_sql1 = "DELETE from tblExACS" DoCmd.RunSQL (str_sql1) -------------------------------------------------------------------------------------------------------------- Yet when I execute the following SQL statement in the form load, I get an error message Run time error '2342' A RunSQL action requires an argument consisting of a SQL statement str_sql1 = "SELECT top 1 right([Acct Number],6) As intCustomer, left([Acct Number],4) As intOffice from tblSpACS order by intOffice" DoCmd.RunSQL (str_sql1) This SQL statement executes fine in the SQL Query Analyzer. 0 Question by:zimmer9 Facebook Twitter LinkedIn Google LVL 44 Best Solution byLPurvis Have you set the rowsource of cmbOffice successfully? Then Me.cmbOffice = Me.cmbOffice.ItemData(0) Go to Solution 12 Comments LVL 64 Overall: Level 64 MS Access 42 Message Active today Expert Comment by:Jim Horn2006-03-15 (Wild guess) >str_sql1 = "SELECT top 1 right([Acct Number],6) As intCustomer, left([Acct Number],4) As intOffice from tblSpACS order by intOffice" should be str_sql1 = "SELECT top 1 right([Acct Number],6) As intCustomer, left([Acct Number],4) As intOffice from tblSpACS order by left([Acct Number],4)" 0 LVL 44 Overall: Level 44 MS Access 44 Message Expert Comment by:LPurvis2006-03-15 You're running a Select statement? 0 Message Active 2 days ago Author Comment by:zimmer92006-03-15 I wanted to initialize my cascading combo boxes with the first Account Number in the data base when the form opens so that they would have an initial value. 0 LVL 44 Overall: Level 44 MS Access 44 Message Expert Commen