Wrox Programmer Forums
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 14th, 2010, 03:23 PM
Registered User
Join Date: May 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Syntax error in FROM clause.

I am running the following code:
Dim MDBInfoCMD As ADODB.Command
Dim lngInfoCnt As Integer
VSGSAMDB is active conection
strSAMTotCntSql declared

Set VGInfoTable = New ADODB.Recordset
Set MDBInfoCMD = New ADODB.Command
Set MDBInfoCMD.ActiveConnection = VSGSAMDB

MDBInfoCMD.CommandText = strSAMTotCntSql
strSAMTotCntSql = "SELECT Count([MDB Information].converted) AS Cnt FROM [MDB Information];"

VGInfoTable.Open strSAMTotCntSql, VSGSAMDB, adOpenKeyset, adLockOptimistic, adCmdTable

Having no issues at all to run this within the database, but in VB6 code i am getting the following error:
Syntax error in FROM clause.
Old May 15th, 2010, 12:30 AM
Authorized User
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts

SELECT COUNT(*) AS CNT FROM tablename WHERE fieldname = criteria...

(*) could be field name that has an index (to make it faster, where clause is optional...

SELECT COUNT(fieldname) AS CNT FROM tablename

Good Luck

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error in FROM clause. jaz061459 Pro VB Databases 1 May 15th, 2010 12:32 AM
Syntax error in FROM clause: asp jpindi ASP.NET 1.0 and 1.1 Basics 6 July 16th, 2008 12:30 AM
syntax for where clause with like operator Yasho VB.NET 2002/2003 Basics 2 June 11th, 2007 08:34 AM
error '80040e14' Syntex error in From clause alisonchase Access ASP 5 January 2nd, 2005 10:56 AM
Syntax error in query. Incomplete query clause. dispickle ADO.NET 3 April 16th, 2004 01:04 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.