Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Lexical Element missing...Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 Lexical Element missing... 
 Author   Message 
  Steve 
  
 Group: Members 
 Posts: 8 
 Joined: 2006-09-29 
 Profile
 Posted : 2006-09-30 04:03:37
The following statement works fine in MS Access using QODBC. When using the remote connector through ASP however, the statement says its missing a Lexical Element.  I've rearranged the script, removed parts of it that I thought perhaps the system was confused on (per other posts in this forum) but I can't seem to locate the error.  here is the original script:

SELECT s.CustomerRefListID, CustomerRefFullName, s.CustomFieldEmail, Count(*) AS NumberOfOrders, Sum(s.Subtotal) AS TotalSpent
FROM Sales AS s
WHERE (((s.ShipDate) Between Date() And Date()-365))
GROUP BY s.CustomFieldEmail, s.CustomerRefFullName, s.CustomerRefListID
HAVING (((Count(*))>=3) AND ((Sum(s.Subtotal))>1000));

The purpose of the script is to return all customers who have ordered 3 or more times in the last three years who have purchased more than $1000.00 worth.  The lexical element missing varies from ")" to "as" and even "<identifier>"...  it's kinda confusing.

Any help would be greatly appreciated. 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-10-02 08:42:07

MS Access has some extended functions that are not available outside Access. Try:

SELECT s.CustomerRefListID, s.CustomerRefFullName, s.CustomFieldEmail,
Count(*) AS NumberOfOrders, Sum(s.Subtotal) AS TotalSpent
FROM Sales s
WHERE (((s.ShipDate) Between {fn CURDATE()} And {fn CURDATE()}-365))
GROUP BY s.CustomFieldEmail, s.CustomerRefFullName, s.CustomerRefListID
HAVING (((Count(*))>=3) AND ((Sum(s.Subtotal))>1000))

 

  Top 
  Mitch 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-12-22 
 Profile
 Posted : 2006-12-22 04:07:08

Receiving a QODBC error; "ERROR [42000] ... Expected lexical element not found: =" while attempting an update ... SQL follows.

UPDATE SalesOrder SET SalesOrder.Memo = 'TEST_VALUE' WHERE SalesOrder.RefNumber = 'TEST_ID'

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-12-22 10:55:49

You can't use a table name in the SET, this will work:

UPDATE SalesOrder SET Memo = 'TEST_VALUE' WHERE SalesOrder.RefNumber = 'TEST_ID'

 

  Top 
  victorking 
  
 Group: Members 
 Posts: 7 
 Joined: 2008-05-07 
 Profile
 Posted : 2008-06-06 02:38:05

 

The following QODBC error; "ERROR [42000] ... Expected lexical element not found: =" while attempting an Insert ... SQL follows.

strQBInt = "INSERT INTO "

strQBInt += "InvoiceLine ("

strQBInt += " CustomerRefListID "

strQBInt += ", RefNumber "

strQBInt += ", InvoiceLineItemRefListID "

strQBInt += ", InvoiceLineDesc "

strQBInt += ", InvoiceLineQuantity "

strQBInt += ", FQSaveToCache )"

strQBInt += " VALUES ( '"

strQBInt += strClient_QBRef.ToString() + "'"

strQBInt += ",'" + strInvNumber.ToString() + "'"

strQBInt += ",'" + strQBCode.ToString() + "'"

strQBInt += ",'" + strLIDesc.ToString() + "'"

strQBInt += ",'" + strUnits.ToString() + "'"

strQBInt += ",'" + (IIf(blnCommit, "0", "1"))

strQBInt += " )"

Is there anything am doing wrong??

Thanks

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-06-06 07:34:45

InvoiceLineQuantity is not a string, so it shouldn't have single quotes around the value. It should be: strQBInt += "," + strUnits.ToString() + ""

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to