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 : [QODBC] Expected Lexical element not found: <identifier> code 80040e14Search Forum

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

 New Topic 
 
 Post Reply 
[1]  
 [QODBC] Expected Lexical element not found: <identifier> code 80040e14 
 Author   Message 
  David Ericksen 
  
 Group: Members 
 Posts: 5 
 Joined: 2007-06-02 
 Profile
 Posted : 2007-06-20 06:01:50

I have this script that a co-worker that is on vaction wrote on his pc with the demo versions of Quickbooks and the QODBC driver.

I get the " Expedted Lexical element not found" error when I try to run the script.

I am on a workstation using a data file up on the server

here is the script  Any advice would be appreciated

Thank you

David

-----------------------------------------------------

Dim oConnection
Dim oRecordset
Dim sMsg
Dim sConnectString
Dim sSQL

Const ForReading = 1
Const ForWriting = 2

strFile = "C:\OrderIn.txt"

' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(strFile) Then
 'Do Nothing
Else
 Set objFile = objFSO.CreateTextFile(strFile)
End If

'Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\OrderNum.txt", ForReading)

strText = objFile.ReadAll
vOrderID = strText

strText = MID(strText,1,15)
strText = TRIM(strText)
strText = Date() - 30
strText = MID(strText,7,4) & "-" & MID(strText,1,2) & "-" & MID(strText,4,2)

sSQL = "SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d " & Chr(39) & strText & Chr(39) & "}"

sConnectString = "DSN=QuickBooks;OLE DB Services=-2;"

Set oConnection = CreateObject("ADODB.Connection")
Set objFile = objFSO.OpenTextFile("C:\OrderIn.txt", ForWriting)

oConnection.Open sConnectString

SET oRecordset =  oConnection.execute(sSQL)

Do While Not oRecordSet.eof

 If IsNull(oRecordSet.Fields("REFNUMBER")) = False Then
  strNewText = oRecordSet.Fields("REFNUMBER") & Space(11 - Len(oRecordSet.Fields("REFNUMBER")))
 Else
  strNewText = Space(11)
 End If
 
 If IsNull(oRecordSet.Fields("REFNUMBER")) = False Then
  strNewText = strNewText & "L" & oRecordSet.Fields("REFNUMBER") & Space(10 - Len(oRecordSet.Fields("REFNUMBER")))
 Else
  strNewText = strNewText & Space(11)
 End If

 if isNull(oRecordSet.Fields("ShipAddressAddr1")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressAddr1") & Space(41 - Len(oRecordSet.Fields("ShipAddressAddr1")))
 else
  strNewText = strNewText & Space(11)
 end if
 if isnull(oRecordSet.Fields("ShipAddressAddr2")) = False Then 
  strNewText = strNewText & oRecordSet.Fields("ShipAddressAddr2") & Space(41 - Len(oRecordSet.Fields("ShipAddressAddr2")))
 else
  strNewText = strNewText & Space(41)
 end if
 if isnull(oRecordSet.Fields("ShipAddressAddr3")) = False Then 
  strNewText = strNewText & oRecordSet.Fields("ShipAddressAddr3") & Space(41 - Len(oRecordSet.Fields("ShipAddressAddr3")))
 else
  strNewText = strNewText & Space(41)
 end if
 if isnull(oRecordSet.Fields("ShipAddressAddr4")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressAddr4") & Space(41 - Len(oRecordSet.Fields("ShipAddressAddr4")))
 else 
  strNewText = strNewText & Space(41)
 end if
 if isnull(oRecordSet.Fields("ShipAddressAddr5")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressAddr5") & Space(41 - Len(oRecordSet.Fields("ShipAddressAddr5")))
 else
  strNewText = strNewText & Space(41)
 end if
 if isnull(oRecordSet.Fields("ShipAddressCity")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressCity") & Space(31 - Len(oRecordSet.Fields("ShipAddressCity")))
 else
  strNewText = strNewText & Space(31)
 end if
 if isnull(oRecordSet.Fields("ShipAddressState")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressState") & Space(31 - Len(oRecordSet.Fields("ShipAddressState")))
 else
  strNewText = strNewText & Space(31)
 end if
 if isnull(oRecordSet.Fields("ShipAddressPostalCode")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressPostalCode") & Space(13 - Len(oRecordSet.Fields("ShipAddressPostalCode")))
 else
  strNewText = strNewText & "jjj" & Space(13)
 end if
 if isnull(oRecordSet.Fields("ShipAddressCountry")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipAddressCountry") & Space(31 - Len(oRecordSet.Fields("ShipAddressCountry")))
 else
  strNewText = strNewText & Space(31)
 end if
 if isnull(oRecordSet.Fields("CustomerRefListID")) = False then
  strNewText = strNewText & oRecordSet.Fields("CustomerRefListID") & Space(36 - Len(oRecordSet.Fields("CustomerRefListID")))
 else
  strNewText = strNewText & Space(36)
 end if
 if isnull(oRecordSet.Fields("ShipMethodRefListID")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipMethodRefListID") & Space(36 - Len(oRecordSet.Fields("ShipMethodRefListID")))
 else
  strNewText = strNewText & Space(36)
 end if
 if isnull(oRecordSet.Fields("ShipMethodRefFullName")) = False then
  strNewText = strNewText & oRecordSet.Fields("ShipMethodRefFullName") & Space(15 - Len(oRecordSet.Fields("ShipMethodRefFullName")))
 else
  strNewText = strNewText & Space(15)
 end if

 'Get data from customer table 
 if isnull(oRecordSet.Fields("CustomerRefListID")) = False then
  sSQL = "SELECT * FROM CUSTOMER WHERE LISTID = '" & oRecordSet.Fields("CustomerRefListID") & "'"
  SET oERecordset =  oConnection.execute(sSQL)
 End If 
 
 if isnull(oERecordSet.Fields("EMAIL")) = False then
  strNewText = strNewText & oERecordSet.Fields("email") & Space(60 - Len(oERecordSet.Fields("email")))
 else
  strNewText = strNewText & Space(60)
 end if

 if isnull(oERecordSet.Fields("CompanyName")) = False then
  strNewText = strNewText & oERecordSet.Fields("CompanyName") & Space(41 - Len(oERecordSet.Fields("CompanyName")))
 else
  strNewText = strNewText & Space(41)
 end if

 if isnull(oERecordSet.Fields("Contact")) = False then
  strNewText = strNewText & oERecordSet.Fields("Contact") & Space(41 - Len(oERecordSet.Fields("Contact")))
 else
  strNewText = strNewText & Space(41)
 end if

 if isnull(oERecordSet.Fields("Phone")) = False then
  strNewText = strNewText & oERecordSet.Fields("Phone") & Space(21 - Len(oERecordSet.Fields("Phone")))
 else
  strNewText = strNewText & Space(21)
 end if


 objFile.WriteLine strNewText

 intcnt = intcnt + 1

 


oRecordSet.movenext

Loop

oConnection.Close
objFile.Close
Set oConnection = Nothing


MsgBox("Total Orders found " & intcnt)

 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-06-20 08:43:51

It isn't possible to look at a script and guess the actual error. Please go to the QODBC Setup Screen, press the "Messages" tab page, click on the "Review QODBC Messages" button and scroll down to the end where the error is and paste the actual error section in your reply (just the section with the error).

 

  Top 
  David Ericksen 
  
 Group: Members 
 Posts: 5 
 Joined: 2007-06-02 
 Profile
 Posted : 2007-06-20 22:20:44

The error is coming from line 41 which reads      oConnection.Open sConnectString

The regular message log is empty here is the SDK log and I turned on the trace log there is a copy of that below the SDK  log

20070620.080517 I 3784 CertVerifier The file does not contain an Authenticode signature.

20070620.080517 I 3784 RequestProcessor ========= Started Connection =========
20070620.080517 I 3784 RequestProcessor Request Processor, QBXMLRP2 v6.0
20070620.080517 I 3784 RequestProcessor Connection opened by app named 'FLEXquarters QODBC'
20070620.080519 I 3784 RequestProcessor Opening the file in the DoNotCare mode.
20070620.080519 I 376 QBSDKProcessRequest Application named 'FLEXquarters QODBC' starting requests (process 3784).
20070620.080519 I 376 SpecVersion Current version of qbXML in use: 4.0
20070620.080519 I 376 QBSDKMsgSetHandler QUERY: Host
20070620.080519 I 376 QBSDKMsgSetHandler Request 1 completed successfully.
20070620.080519 I 376 QBSDKMsgSetHandler QUERY: Company
20070620.080519 I 376 QBSDKMsgSetHandler Request 2 completed successfully.
20070620.080519 I 376 QBSDKMsgSetHandler QUERY: DataExtension Definition
20070620.080519 I 376 QBSDKMsgSetHandler Request 3 completed successfully.
20070620.080519 I 376 MsgSetHandler Finished.
20070620.080519 I 376 QBSDKProcessRequest Application named 'FLEXquarters QODBC' finishing requests (process 3784), ret = 0.
20070620.080521 I 3784 RequestProcessor Connection closed by app named 'FLEXquarters QODBC'
20070620.080521 I 3784 RequestProcessor ========== Ended Connection ==========

 

here is a copy of the trace log

ISAMOpen
    Database: .
    DSN: QuickBooks
    UserName:
    Password:
    DeveloperCode:
    ApplicationCode:
    OpenMode: F
    UseDCOM: N
    IBizRemoteConnection: N
    IBizRemoteURL: http://localhost:2080
    IBizRemoteUserName: admin
    IBizRemotePassword:
    IBizRemoteAskPassword: Y
    IBizRemoteSSLAcceptServerCert:
    IBizRemoteConnectionTimeOut: 120
    IBizRemoteForce2002_2003: N
    IBizOEConnection: N
    IBizOETicketGUID:
    IBizOELoginGUID:
    IBizOELoginAsk: Y
    IBizReconnectionDelay: 0
    ColumnNameLen: 50
    UseCaseSensitiveRefNumber: Y
    OptimizerOn: Y
    OptimizerDBFolder: C:\Documents and Settings\Warehouse\Application Data\QODBC Driver for QuickBooks\Optimizer
    OptimizerCurrency: C
    OptimizerDirtyReads: N
    OptimizerUpdateSync: N
    OptimizerEncrytionOn: Y
    UseIterators: Y
    IteratorChunkSize:  500
    IAppLaunchQBUI: Y
    IAppAutomaticLogin: Y
    IAppReadOnly: N
    IAppAllowPersonalData: Y
    ConvertToLongVARCHAR: FALSE
    MaxLONGVARCHAR:  4096
    Convert To LONGVARCHAR: N
    Max LONGVARCHAR:   4096
    OleInitialize - Returned OK
    Logged In User:    Warehouse
    Is a Service:      No
    Registration Name: Lymphedema Products, LLC
    RegSerial:         W07U10016454
    QODBC Version:     7.00.00.214
    DLL:               C:\WINDOWS\system32\fqqb32.dll
    Driver Name:       FQQB32.DLL
    Process Count:     1
    Thread Count:      0
    OpenMode:          Follow Company
    Include Raw:       No
    Version Type:      QODBC Desktop Read Write 2007
    Access Method:     QBXMLRP2.DLL (IAuth2)
    Thread ID:         864
    SDK Module:        QBXMLRP2.DLL (IAuth2)
    QB Company Name:   C:\Pitney Bowes Files\Test Data Local.QBW
    QB Product Name:   QuickBooks Premier Edition 2007
    QB Major Version:  17
    QB Minor Version:  0
    QB File Mode:      MultiUser
    QB Automatic Login:No
    QB Country:        US
    QB Supported Ver:  1.0
    QB Supported Ver:  1.1
    QB Supported Ver:  2.0
    QB Supported Ver:  2.1
    QB Supported Ver:  3.0
    QB Supported Ver:  4.0
    QB Supported Ver:  4.1
    QB Supported Ver:  5.0
    QB Supported Ver:  6.0
    Optimize SQLITE3 Library Version: 3003007
    Optimize File Contents: C:\Documents and Settings\Warehouse\Application Data\QODBC Driver for QuickBooks\Optimizer\Test Data Local.OPT
        type                      name                      tbl_name                  rootpage                  sql                                                                                                 
        ========================= ========================= ========================= ========================= ====================================================================================================
        table                     FQOptimizeList            FQOptimizeList            2                         CREATE TABLE "FQOptimizeList"("FQOptimizeList_OptimizeName" VARCHAR(50) NOT NULL UNIQUE COLLATE NOCA
        index                     sqlite_autoindex_FQOptimi FQOptimizeList            3                                                                                                                             
        table                     FQOptimizeVersion         FQOptimizeVersion         4                         CREATE TABLE "FQOptimizeVersion" ("FQOptimizeVersion_CompanyName" VARCHAR(1000), "FQOptimizeVersion_
    FQOptimizeList Contents
        OptimizeName              TableList                 SQL                       LastTimeModified          LastTimeDeleted           LastTransactionTimeModifi LastTransactionTimeModifi LastTransactionTimeModifi LastTransactionTimeModifi TimeOfSecu
        ========================= ========================= ========================= ========================= ========================= ========================= ========================= ========================= ========================= ==========
    FQOptimizeVersion Contents
        CompanyName               Version                  
        ========================= =========================
        Lymphedema Products, LLC  3                        
    Optimize File: C:\Documents and Settings\Warehouse\Application Data\QODBC Driver for QuickBooks\Optimizer\Test Data Local.OPT
    0x00194F50 [ISAM]
    NO_ISAM_ERR 00000 00000
    Connect MaxRows Set: 0
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMName
    0x00194F50 [ISAM]
    QODBC [FLEXquarters]
ISAMName
    0x00194F50 [ISAM]
    QODBC [FLEXquarters]
ISAMVersion
    0x00194F50 [ISAM]
     7.00.00.214
ISAMVersion
    0x00194F50 [ISAM]
     7.00.00.214
ISAMCaseSensitive
    0x00194F50 [ISAM]
    FALSE
ISAMCaseSensitive
    0x00194F50 [ISAM]
    FALSE
ISAMUser
    0x00194F50 [ISAM]
   
ISAMUser
    0x00194F50 [ISAM]
   
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMPrepare
    0x00194F50 [ISAM]
    SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d '007-5/-1/'}
    75
    0x00000000 [ISAMStatement]
   
    0
    10003
ISAMName
    0x00194F50 [ISAM]
    QODBC [FLEXquarters]
ISAMName
    0x00194F50 [ISAM]
    QODBC [FLEXquarters]
ISAMVersion
    0x00194F50 [ISAM]
     7.00.00.214
ISAMVersion
    0x00194F50 [ISAM]
     7.00.00.214
ISAMCaseSensitive
    0x00194F50 [ISAM]
    FALSE
ISAMCaseSensitive
    0x00194F50 [ISAM]
    FALSE
ISAMUser
    0x00194F50 [ISAM]
   
ISAMUser
    0x00194F50 [ISAM]
   
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMDriver
    0x00194F50 [ISAM]
    FQQB32.DLL
ISAMPrepare
    0x00194F50 [ISAM]
    { call SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d '007-5/-1/'} }
    84
    0x00000000 [ISAMStatement]
   
    0
    10003
ISAMPrepare
    0x00194F50 [ISAM]
    select * from SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d '007-5/-1/'}
    89
    0x00000000 [ISAMStatement]
   
    0
    10003
ISAMClose
    0x00194F50 [ISAM]
    Optimize SQLITE3 Library Version: 3003007
    Optimize File Contents: C:\Documents and Settings\Warehouse\Application Data\QODBC Driver for QuickBooks\Optimizer\Test Data Local.OPT
        type                      name                      tbl_name                  rootpage                  sql                                                                                                 
        ========================= ========================= ========================= ========================= ====================================================================================================
        table                     FQOptimizeList            FQOptimizeList            2                         CREATE TABLE "FQOptimizeList"("FQOptimizeList_OptimizeName" VARCHAR(50) NOT NULL UNIQUE COLLATE NOCA
        index                     sqlite_autoindex_FQOptimi FQOptimizeList            3                                                                                                                             
        table                     FQOptimizeVersion         FQOptimizeVersion         4                         CREATE TABLE "FQOptimizeVersion" ("FQOptimizeVersion_CompanyName" VARCHAR(1000), "FQOptimizeVersion_
    FQOptimizeList Contents
        OptimizeName              TableList                 SQL                       LastTimeModified          LastTimeDeleted           LastTransactionTimeModifi LastTransactionTimeModifi LastTransactionTimeModifi LastTransactionTimeModifi TimeOfSecu
        ========================= ========================= ========================= ========================= ========================= ========================= ========================= ========================= ========================= ==========
    FQOptimizeVersion Contents
        CompanyName               Version                  
        ========================= =========================
        Lymphedema Products, LLC  3                        
    NO_ISAM_ERR 00000 00000

 

  Top 
  David Ericksen 
  
 Group: Members 
 Posts: 5 
 Joined: 2007-06-02 
 Profile
 Posted : 2007-06-20 23:57:13

 

Running this select statement in VB Demo gives me an error of  [QODBC]Expected Lexical element not found <identifier>

sSQL = "SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d " & Chr(39) & strText & Chr(39) & "}"

 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-06-21 04:02:11

If you look at the trace you'll see its the data coming from "C:\OrderIn.txt" that's invalid. The select statement ends up being:

SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d '007-5/-1/'}

when it should be:

SELECT * FROM INVOICE WHERE REFNUMBER > '1' AND SHIPDATE >= {d '2007-05-01'}

Please correct the dates in Orderln.txt.

 

  Top 
  David Ericksen 
  
 Group: Members 
 Posts: 5 
 Joined: 2007-06-02 
 Profile
 Posted : 2007-06-21 22:16:27

Thank you

I will look into the dates and resolve the issue

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to