Accessing Linked SQL tables in Access
I have a linked table in access that is linked to SQL database. The table name is linked_table and for argument sake the db is named database. I have the following code in asp
<%@ LANGUAGE="VBSCRIPT" %>
<%response.buffer = true %>
<%
Dim objConn
Dim objRS
application("ADOSqlConnection") = "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\somedirectory\database.mdb"
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open(application("ADOSqlConnection"))
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection=objConn
sSQL="SELECT * FROM linked_table"
response.write ssql
objRS.open(sSQL)
do while not objrs.EOF
response.write objrs("Commitment") & "<br>"
objrs.MoveNext
loop
objRS.close
Set objRS=Nothing
objConn.Close
set objConn=Nothing
%>
<html>
<body>
test
</body>
</html>
The code does well until it hits objRS.open(sSQL)
The error is as follows
SELECT * FROM MASTER_JCM_COMMITMENT
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC Microsoft Access Driver] Could not execute query; could not find linked table.
/test.asp, line 27
|