current provider does not support the necessary interface for index functionality

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I am getting the following error when trying to run this code. This code
worked prior to splitting the database and I can't see what is wrong. When
debugging cursor location shows as adUseServer and even tried using code to
make sure with no luck. Hope someone can help as getting frustrated.

Thanks
Chris

error: Current Provider does not support the necessary interface for index
functionality

Sub GetDatabaseinfo()
Dim sBldgName As String, sFloor As String, sProductNo, curPrice As Currency
Dim iQty As Integer, curExtPrice As Currency, iProductID As Integer
Dim icounter As Integer, strProductName As String
Dim cnn As ADODB.Connection
Dim recProd As ADODB.Recordset
Dim rstQuotes As ADODB.Recordset
Dim rstothercost As ADODB.Recordset
Dim strSQLOther As String
Dim strSQLTable As String
Dim strSQLQuery As String


'Open connection
Set cnn = New ADODB.Connection

Set recProd = New ADODB.Recordset
Set rstQuotes = New ADODB.Recordset
Set rstothercost = New ADODB.Recordset
strSQLTable = "AtlasProducts"

recProd.CursorLocation = adUseServer
rstQuotes.Open "qdetails", CurrentProject.Connection, adOpenStatic
rstothercost.Open "qothercosts", CurrentProject.Connection, adOpenStatic
recProd.Open strSQLTable, CurrentProject.Connection, adOpenKeyset,
adLockReadOnly, adCmdTableDirect

If recProd.Supports(adIndex) And recProd.Supports(adSeek) Then 'note this
used to work and now doesn't
recProd.Index = "PrimaryKey"
End If

With rstQuotes

Do

sBldgName = .Fields("BldgDescrp")
sFloor = .Fields("Floor")
iProductID = rstQuotes("ProductID")
recProd.Seek iProductID, adSeekFirstEQ 'triggers the error
message obviously because no index set from above.
 
Back
Top