Visual Basic and C/ODBC and error

Hi when I use this code in visual basic 6 Dim con As ADODB.Connection Set con = New ADODB.Connection con.ConnectionString = “Provider=MSDASQL.1;Persist Security Info=False;User ID=;Data Source=Navision Server Database” con.Open Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sqlstring = “select * from ‘G/L entry’ where Entry No_ = 1” rs.Open sqlstring, con While Not rs.EOF Text1.Text = rs(“Entry No_”) rs.MoveNext Wend con.Close I get this error [Navision a/s][Navision Attain ODBC Driver]Expected lexical element not found: Does anyone has an idee how to fix the problem? tanks

Check you ODBC settings: what is the setting for Identifiers. Try “a-z,A-Z,0-9”. In the ODBC documentation you’ll find how to correctly specify identifiers with these settings.

That did not solve my problems. Even All characters did not work. could it be somthing else then the ODBC?

Table and field names are case sensitive, plus, you have to use the double quote (") when you have fields or table names with spaces. The correct table name is “G/L Entry”, not “G/L entry”. The line that mentions the SQL statement in VB should look like the following: sqlstring = “select * from ““G/L Entry”” where ““Entry No_”” = 1”

Great Tank you.

I have been busy intergrating Piccolink Hand held terminals with Navision. We validate the data from the Piccolink line by line with the navision Database. I found in the C/ODBC guide how to translate things in the SQL statements. I use “a-z,A-Z,0-9” and Language neutral Then you can use the English table and field names. In the next string you should replace all ‘strange’ characters and all spaces through underscores: sqlstring = “select * from ““G_L_Entry”” where ““Entry_No_”” = 1” As you see only a-z,A-Z and 0-9 are used. I hope this will help you. Martien Lange