I have a MS Access 2000 front end app connecting to a SQL Server database back end. The problem I'm having is selecting an index on a table in the back end. Here is the code:
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim bill As DAO.Recordset
Dim cn As DAO.Connection
Set ws = CreateWorkspace("", "admin", "", dbUseODBC)
Set cn = ws.OpenConnection("", , , "ODBC;DSN=ESource"
Set db = cn.Database
Set bill = db.OpenRecordset("Billing", dbOpenDynamic)
bill.Index = "PK_Billing"
bill.MoveFirst
MsgBox "record " & bill![Record Number]
db.Close
I get runtime error 3251 "Operation is not supported for this type of object" on the bill.Index = "PK_Billing" code.
This is the first time I've tried the Access front end with SQL back end. The documentation I have found so far indicates this should work. Can I not select an index in this way on a SQL Server table? If not, how is indexing handled?
Thanks.
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim bill As DAO.Recordset
Dim cn As DAO.Connection
Set ws = CreateWorkspace("", "admin", "", dbUseODBC)
Set cn = ws.OpenConnection("", , , "ODBC;DSN=ESource"
Set db = cn.Database
Set bill = db.OpenRecordset("Billing", dbOpenDynamic)
bill.Index = "PK_Billing"
bill.MoveFirst
MsgBox "record " & bill![Record Number]
db.Close
I get runtime error 3251 "Operation is not supported for this type of object" on the bill.Index = "PK_Billing" code.
This is the first time I've tried the Access front end with SQL back end. The documentation I have found so far indicates this should work. Can I not select an index in this way on a SQL Server table? If not, how is indexing handled?
Thanks.