I am trying to find values in my recordset with Find
as Seek
does not seem to be supported, but I can't get past the error
Rowset does not support scrolling backward
According to this SO thread, I have to specify adOpenDynamic
, but this did not change the error code.
I am using a stored procedure (sp_fkeys
), which returns all keys for all tables, and in this case for one table as I specify the table name.
Private Sub maintablebox_Change()
Dim cnn As ADODB.Connection
Dim keys As ADODB.Recordset
Set cnn = New ADODB.Connection
connstring = "omitted"
cnn.Open connstring
Set keys = New ADODB.Recordset
keys.CursorLocation = adUseServer
query = "EXEC sp_fkeys @fktable_name = 'astAssets'"
keys.Open query, connstring, adOpenDynamic, adLockReadOnly
' >>>>>Error on the line below
keys.Find "PKTABLE_NAME = 'astAssetTypes'"
Debug.Print keys.Fields("FKCOLUMN_NAME")
End Sub