Ms Access Runtime Error 2342
Contents |
Case and Cooling Fetish CPU & Motherboard Technologia Mobile Computing Outpost Networking Matrix Other Hardware Agora Classifieds Ars DIY
Runtime Error 7874
Forum (Name TBD!) Operating Systems & Software Battlefront Microsoft OS & run a select query in vba access Software Colloquium Linux Kung Fu Windows Technical Mojo Distributed Computing Arcana Macintoshian Achaia a runsql action requires an argument consisting of an sql statement Programmer's Symposium The Server Room Ars Lykaion Gaming, Extra Strength Caplets The Lounge The Soap Box The Boardroom The Observatory Ars Help & Feedback
Select Query In Access Vba
Ars Subscription Member Areas Image Galleries MS Access DoCMD.RunSQL == Run-time error '2342' 7 posts LordJosh "Down with Pants! Up with Skirts!" Ars Legatus Legionis et Subscriptor Tribus: Derry, NH, USA Registered: Jul 11, 2003Posts: 11252 Posted: Thu Jan 26, 2006 9:04 am Run-time Error '2342' states:"A RunSQL action requires an argument consisting of an SQL statement."I am having some
Openrecordset Access
issues with an inline query to sum up the amount of payments made in this one database (which logs all Overpayments made, this SQL is to figure out which have been paid back to the proper amount)Here is some code (this is within the _Click() subroutine for a button):Dim WI_Num As String 'oooo Variable is instantiatedWI_Num = Me.Overpayment_ 'checked this out with a msgbox, and it shows up kosherDoCmd.RunSQL "SELECT Sum([Payments Table].[Payment Amount]) AS Payment_Sum FROM [Payments Table] WHERE ((([Payments Table].[Overpayment#])=""" & WI_Num & """));" 'OMGWTFBBQ!?! My SQL is a little ugly with all the parens in there'(I cheated and did a design view query, then modded the SQL view - mostly just to get Access' naming convention right)/codeI have checked and re-checked the table names, and field names. I have tried with single, double, and no quotation marks around the WI_Num variable. I have tried making a string and putting the SQL statement in there, then doing the DoCmd.RunSQL mySQLString thing.Nada.So, my questions to you, oh great and powerful hivemind are:Does Access choke on the sum() function for SQL?Have I missed so
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us select statement in vba Learn more about Stack Overflow the company Business Learn more about hiring developers or
Ms Access Openrecordset
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow access vba run query Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SELECT query does not work when converted to http://arstechnica.com/civis/viewtopic.php?t=331686 VBA - invalid SQL statement up vote 1 down vote favorite I have been struggling with SQL statement when converted to VBA. Basically, I wish to add something to it before executing (which shouldn't be a problem). However, when I try to run it before changes, VBA does not recognize it as a valid SQL statement. Despite trying to add/remove brackets and any other special character, it still http://stackoverflow.com/questions/27421873/select-query-does-not-work-when-converted-to-vba-invalid-sql-statement does not work. Please note, that it works perfectly when run as a query. Please see the string below: SQLstr = "SELECT SourceData.[Fiscal Year], SourceData.[Fiscal Quarter ID], " _ & "SourceData.[Transaction Date], SourceData.[Sales Order Number], SourceData.[Activated?], " _ & "SourceData.[Product ID], SourceData.[Bookings Quantity], SourceData.[Term Length], " _ & "SourceData.[Estimated Expiring Quarter], SourceData.[End Customer Company Name], " _ & "SourceData.[Sold To Company Name] " _ & "FROM SourceData, finalCust, finalPart " _ & "WHERE (((SourceData.[End Customer Company Name]) Like finalCust.[FinalList]) " _ & "And ((SourceData.[Sold To Company Name]) Like finalPart.[FinalList]))" The code is 'pure' SQL into VBA, without any amendments but I don't want to mislead. Here's an error message: Run-time error '2342': A RunSQL action requires an argument consisting of an SQL statement. Which I would consider as unreadable SQL statement for VBA. sql vba ms-access access-vba ms-access-2010 share|improve this question edited Dec 11 '14 at 14:22 HansUp 79.3k114371 asked Dec 11 '14 at 11:32 Kacper SobociĆski 84 1 can you post the whole error please –Matt Dec 11 '14 at 11:35 You have included three tables, but no relationship (/JOINS) between them. Why? Could possibly be a reason for your error. –PaulFrancis Dec 11 '14 a
Guest Guest of an SQL statement" Hello, I cannot figure out what is wrong with the code below. I keep getting the above runtime error. But it runs no problem in Desiqn Query mode, once I've set http://www.pcreview.co.uk/threads/runtime-error-2342-a-runsql-action-requires-an-argument-consist.1639011/ the primary keys for the two tables. Any idea what the problem is? Dim strSQL As String strSQL = "SELECT zmax2.*, rooting2.* " & _ "FROM zmax2 LEFT JOIN rooting2 " & _ "ON zmax2.musym = rooting2.musym" 'Turn off https://www.tutcity.com/access/error-2342-docmd-runsql.62388.html warning message. DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'Re-enable warning message DoCmd.SetWarnings True RichardA Guest, Jun 14, 2004 #1 Advertisements John Spencer (MVP) Guest RunSql requires an action query - DELETE, APPEND, UPDATE, ... A SELECT query is NOT ms access an action query. What are you trying to accomplish with this code? Open a recordset? Display a query? RichardA wrote: > > of an SQL statement" > > Hello, I cannot figure out what is wrong with the code below. I keep getting the above runtime error. But it runs no problem in Desiqn Query mode, once I've set the primary keys for the two tables. Any idea what the problem is? > > Dim strSQL select query in As String > strSQL = "SELECT zmax2.*, rooting2.* " & _ > "FROM zmax2 LEFT JOIN rooting2 " & _ > "ON zmax2.musym = rooting2.musym" > > 'Turn off warning message. > DoCmd.SetWarnings False > > DoCmd.RunSQL strSQL > > 'Re-enable warning message > DoCmd.SetWarnings True > > RichardA John Spencer (MVP), Jun 15, 2004 #2 Advertisements Van T. Dinh Guest RunSQL can only be used to run an *Action* Query (Append / Update / Delete), and NOT a Select Query. -- HTH Van T. Dinh MVP (Access) "RichardA" <> wrote in message news:... > of an SQL statement" > > Hello, I cannot figure out what is wrong with the code below. I keep getting the above runtime error. But it runs no problem in Desiqn Query mode, once I've set the primary keys for the two tables. Any idea what the problem is? > > Dim strSQL As String > strSQL = "SELECT zmax2.*, rooting2.* " & _ > "FROM zmax2 LEFT JOIN rooting2 " & _ > "ON zmax2.musym = rooting2.musym" > > 'Turn off warning message. > DoCmd.SetWarnings False > > DoCmd.RunSQL strSQL > > 'Re-enable warning message > DoCmd.SetWarnings True > > RichardA Van T. Dinh, Jun 15, 2004 #3 Guest Guest Re: Runtime Error: 2342. "A RunSQL action requires an argument con Thanks John. You are right. My overall go
DoSQL() Dim SQL As String SQL = "UPDATE Employees " & _ "SET Employees.Title = 'Regional Sales Manager' " & _ "WHERE Employees.Title = '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. 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 paste SQL directly from Access QBE SQL editor of a query that does indeed work without error, throws the same error Sponsored Links: Read full post... Report an issue Thank you for taking the time to report an issue. What's wrong... Please write below. And write your email address (optional) Similar posts... Run-time error 2342 Within a form, clicking on a combobox I have the following code A) which is generating the run-time error B) A) Private Sub Category_Click() Dim strSQL As String strSQL = "select customers.* from customers" DoCmd.RunSQL strSQL End Sub B) Run-time error '2342': A RunSQL action requires an argument consisting of an SQL statement Run-time error '2342' on Button Assignment I have allocated the foillowing Sub to a Button Clink: Private Sub cmdGo_Click() Dim SQL_Text As String SQL_Text = "SELECT tblClient.*, tblClient.ClientName FROM tblClient WHERE (((tblClient.ClientName)=Carl));" DoCmd.RunSQL SQL_Text, False Me.Requery End Sub I keep getting the error message: Run-time error '2342': A RunSQL action requires an argument consisting of an SQL Statement I thought I had done this. Any ideas please I can try? What is wrong with this sql? Dim SQL as String SQL = "SELECT [Sales Orders].InvoiceDate FROM [Sales Orders] WHERE (