VB, ODBC, ADO and Navision

In a VB application using Data Environment I can access my Navision ODBC connection. When trying to access the Navision ODBC connection by programming with ADO, I am getting the error… [Navision Software a/s][Navision Financials ODBC Driver]Expected lexical element not found: My Code in the Class is as follows (Standard Text is the table) Private Function GetRecordset(strConnectString) As ADODB.Recordset Dim strSource As String strSource = “SELECT * FROM ‘‘Standard Text’’” Set conData = CreateObject(“ADODB.Connection”) Set rsData = CreateObject(“ADODB.Recordset”) conData.CursorLocation = adUseClient conData.ConnectionString = strConnectString conData.Open rsData.CursorType = adOpenForwardOnly rsData.CursorLocation = adUseClient rsData.LockType = adLockReadOnly rsData.Source = strSource rsData.ActiveConnection = conData rsData.Open Set GetRecordset = rsData End Function A Finney CASI Springfield IL afinney@casi400.com

The problem (which is well known to me) has nothing to do with your VB code but with the setup of the ODBC-Datasource: the "Expected lexical element not found: " referres to fieldnames in Navision which contain a Dot. If you set-up the DSN with: Start → settings → control panel → ODBC32 → add You enter the ODBC Setup for the datasource. You will find an Option-Button there which will open the “ODBC Options” dialogue. In Field “Identifiers” you should select “All Characters” instead of the default “all except dots”. This should do the trick. By the way, if you are in the Options dialogue anyway change “Option Field Type” to Integer Marcus Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

The whole error message did not get posted originally [Navision Software a/s][Navision Financials ODBC Driver]Expected lexical element not found: I did has you suggested and I still have the problem. When I change the source string from strSource = “SELECT * FROM ‘‘Standard Text’’” to strSource = “Standard Text” [Navision Software a/s][Navision Financials ODBC Driver]Expected lexical element not found: <keyword A Finney CASI Springfield IL afinney@casi400.com

That did the trick. I just had to reinstall the ODBC driver and set it up initially that way. (Inherited machine) A Finney CASI Springfield IL afinney@casi400.com