Hi
I've run into a case I hope I can get some directions / help on.
Background: Moved a Back End to SQL Server. The server management gave me a user name and pw for access to the sql datafile, used when setting up a DNS to the server, using SQL Server driver.
Now, for some reason I've been asked to change from linked tables with DNS, to direct connect to each table with rsTable.Connection = "Provider=SQLOLEDB;SERVER=SQLnn;DATABASE=nnn_cds;UID=SQL_nnn_cds;PWD=xxxxxxx;"
That's works fine, no probs.
Now I'm converting all queries to selecting Pass Through, and mostly with a clean copy of the sql-string works fine, but when I reffering the (WHERE) to a forms field value, I get the error message; ODBC--call failed .... incorrect sytax near '!'. (#102)
To get standard SQL string to run, I found that the following ODBC Connection string in Querry design works fine:
ODBC;DRIVER={SQL Server};SERVER=SQLnn;DATABASE=nnn_cds;UID=SQL_nnn_cds;PWD=xxxxxx;
I believe usage of - ! - in sql string makes the problem. The actual sql string for one of the queries are:
SELECT Table.Field1, Table.Field2, Table.Field3
FROM Table
WHERE (((Table.Field1)=[Forms]![Ad_VarForm]![txtProjectNo]))
ORDER BY Table.Field2;
Other queries without the usage of ! have worked perfectly when using just a copy from 'old' sql-view in query designg, to the new sql-view after selecting the Pass-Trough.
Please excuse the 'long' message, but I don't now better how to explain this problem... and excuse my lousy english writng...
Brg, Geirr.
I've run into a case I hope I can get some directions / help on.
Background: Moved a Back End to SQL Server. The server management gave me a user name and pw for access to the sql datafile, used when setting up a DNS to the server, using SQL Server driver.
Now, for some reason I've been asked to change from linked tables with DNS, to direct connect to each table with rsTable.Connection = "Provider=SQLOLEDB;SERVER=SQLnn;DATABASE=nnn_cds;UID=SQL_nnn_cds;PWD=xxxxxxx;"
That's works fine, no probs.
Now I'm converting all queries to selecting Pass Through, and mostly with a clean copy of the sql-string works fine, but when I reffering the (WHERE) to a forms field value, I get the error message; ODBC--call failed .... incorrect sytax near '!'. (#102)
To get standard SQL string to run, I found that the following ODBC Connection string in Querry design works fine:
ODBC;DRIVER={SQL Server};SERVER=SQLnn;DATABASE=nnn_cds;UID=SQL_nnn_cds;PWD=xxxxxx;
I believe usage of - ! - in sql string makes the problem. The actual sql string for one of the queries are:
SELECT Table.Field1, Table.Field2, Table.Field3
FROM Table
WHERE (((Table.Field1)=[Forms]![Ad_VarForm]![txtProjectNo]))
ORDER BY Table.Field2;
Other queries without the usage of ! have worked perfectly when using just a copy from 'old' sql-view in query designg, to the new sql-view after selecting the Pass-Trough.
Please excuse the 'long' message, but I don't now better how to explain this problem... and excuse my lousy english writng...

Brg, Geirr.
Last edited: