Excel Sql Syntax Error In From Clause
Contents |
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 Learn more about Stack Overflow the company Business Learn more about access sql syntax error in from clause hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Syntax Error In From Clause Union Query
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join
Syntax Error In From Clause Vba
them; it only takes a minute: Sign up Syntax error in FROM clause Excel VBA up vote 0 down vote favorite Here is my code to retrieve data from access but I always encounter "Run-time error '-2147217900 (80040e14)' Syntax
Syntax Error In From Clause Access 2010
error in FROM clause" Sub UPDATE_REGION() Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim AW As Workbook Set AW = ActiveWorkbook Path = AW.Path cnn_pth = Path & "\Master File.accdb" Set cnn = New ADODB.Connection With cnn .Provider = "Microsoft.ACE.OLEDB.12.0" .Open cnn_pth End With Set rst = New ADODB.Recordset sSQL = "select Package_Nb from [package_db] where [Hubs] is null" rst.Open Source:=sSQL, ActiveConnection:=cnn, CursorType:=adOpenForwardOnly, LockType:=adLockOptimistic, Options:=adCmdTable end subs When i stop script to debug, I found syntax error in from clause vb6 Source value in Local Window like this: "select * from select Package_Nb from package_db where Hubs is null" I don't know why vba auto add select * from to source like this, anyone know how to fix this? excel vba excel-vba syntax-error runtime-error share|improve this question asked Feb 11 '15 at 9:59 Gotte 52 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted Your options are wrong. This: Options:=adCmdTable should be this: Options:=adCmdText Since you are not passing a table name but a SQL string. (when you pass a table name it is effectively converted into a SELECT * FROM table_name statement). share|improve this answer answered Feb 11 '15 at 10:02 Rory 16.4k21219 Tks so much for prompt answer –Gotte Feb 11 '15 at 10:03 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged excel vba excel-vba syntax-error runtime-error or ask your own question. asked 1 year ago viewed 847 times active 1 year ago Related 0Excel vba runtime error # 10040Excel 2010 VBA error: The object invoked h
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, syntax error in from clause access select the forum that you want to visit from the selection below. Results 1 syntax error in from clause excel to 5 of 5 Thread: [RESOLVED] Syntax error in FROM clause Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display syntax error in from clause vb6 adodc Linear Mode Switch to Hybrid Mode Switch to Threaded Mode May 26th, 2007,08:07 AM #1 girl81 View Profile View Forum Posts Thread Starter Addicted Member Join Date Apr 2006 Location Malaysia Posts 211 [RESOLVED] Syntax error in http://stackoverflow.com/questions/28451358/syntax-error-in-from-clause-excel-vba FROM clause Hi all..i was wondering with this error message.. "Syntax error in FROM clause. Run time error '-2147217900' This error happened for Update and Add process when i retrieved the Table PRODUCT from Access..there is no error message again when i change table name PRODUCT to PRODUCT1.. Thanks in advance.. Reply With Quote May 26th, 2007,10:13 AM #2 si_the_geek View Profile View Forum Posts Super Moderator Join Date Jul 2002 Location Bristol, http://www.vbforums.com/showthread.php?471019-RESOLVED-Syntax-error-in-FROM-clause UK Posts 38,306 Re: Syntax error in FROM clause Moved to Database Development forum - which is where SQL/database related questions belong It sounds like Product is a reserved word.. presumably because there is a function with the same name (so there is confusion in working out whether you meant the function, or the table) The ideal solution is what you have done... change the table name. (July 2007 to June 2017) . . . . . . . . . . Hitchhiker's Guide to Getting Help at VBForums Classic VB FAQs (updated Oct 2010) ...Database Development FAQs/Tutorials (updated May 2011) (includes fixing common VB errors) .......... (includes fixing common DB related errors, and [Classic VB] ADO tutorial /further steps, and [VB.Net] ADO.Net Tutorial). Tutorial: How to automate Excel from VB6 (or VB5/VBA) .•. SQL 'Select' statement formatter/checker .•. Convert colour number to colour name .•. FlexGrid: fill from recordset .•. FlexGrid: AutoSize columns .•. DB Reserved Words checker Connection strings .•. MDAC/Jet/ACE downloads .•. SQL Server downloads .•. MZTools (free upgrade for the VB6/VBA Editor) Reply With Quote May 27th, 2007,08:00 AM #3 girl81 View Profile View Forum Posts Thread Starter Addicted Member Join Date Apr 2006 Location Malaysia Posts 211 Re: Syntax error in FROM clause Originally Posted by si_the_geek Moved to Database Development fo
Forums Microsoft Access SQL syntax error in from clause... Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 12 SQL syntax error in from clause...This is a discussion on SQL syntax http://www.mrexcel.com/forum/microsoft-access/422554-sql-syntax-error-clause.html error in from clause... within the Microsoft Access forums, part of the Question Forums category; Hi all. I'm trying to query my access database from outlook vba . I wrote a very basic query in ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 14th, syntax error 2009,03:43 PM #1 krice1974 Board Regular Join Date Jul 2008 Location New Jersey Posts 422 SQL syntax error in from clause... Hi all. I'm trying to query my access database from outlook vba. I wrote a very basic query in access that works, and copied in the sql to access. I get a "syntax error in from clause" on the last line below. Here's what I've got: Code: 'Get the symbol from syntax error in the database. str = "SELECT tblSymbolsMain.Symbol FROM tblSymbolsMain WHERE (((tblSymbolsMain.Company) " & _ "Like '*" & Company & "*'));" 'Open a recordset. Set rsData2 = New ADODB.Recordset rsData2.Open str, conn, adOpenKeyset, adLockOptimistic, adCmdTable Any ideas? As always thanks in advance... Kevin Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Oct 14th, 2009,05:46 PM #2 james_lankford Board Regular Join Date Jan 2009 Posts 1,016 Re: SQL syntax error in from clause... does Company have a single quote in it ? Smith and Son's Groceries would be Like '*Smith and Son's Groceries*' the single quote in the company name would conflict with the single quotes surrounding the name Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Oct 14th, 2009,05:57 PM #3 krice1974 Board Regular Join Date Jul 2008 Location New Jersey Posts 422 Re: SQL syntax error in from clause... Hi James, unfortunately no, the value I'm stuck on that's throwing the error is "Cypress" Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Oct 14th, 2009,06:05 PM #4 james_lankford Board Regular Join Date Jan 2009 Posts 1,016 Re: SQL syntax error in from clause... do debug.print str 'Open a recordset. Set rsData2 = New ADODB.Recordset and set a breakpoint on the set statement and run the