View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
miao jie miao jie is offline
external usenet poster
 
Posts: 14
Default problem in seek value in recordset with index.

Hi,
now I try to use index in recordset to improve my program speed,
I create a table name: values_Clplus_YTD
have three column: entity, account, value. and I create primarykey index for
column entity and account.

now I have code as following,
SQL = "select * from values_Clplus_YTD"
Access_ADO_Connect ' defined function
Set acceRs = New ADODB.Recordset
acceRs.Open SQL, acceConn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
If Not acceRs.EOF Then
If acceRs.Supports(adIndex) And acceRs.Supports(adSeek) Then
acceRs.Index = "PrimaryKey"
acceRs.Seek dataArry, adSeekAfterEQ
MsgBox acceRs.fields("entity") & acceRs.fields("account")
End If
End If

acceRs.Close
Set acceRs = Nothing
Access_ADO_Disconnect ' defined function

acceRs.Supports(adIndex) and acceRs.Supports(adseek) always say false
whenever I set open recordset with adOpenKeyset. so I can't use seek function.

anyone can help me out, thanks in advance