PDA

Click to See Complete Forum and Search --> : DataCombo filter results do not show up correctly


DrewDog_21
Sep 18th, 2000, 02:38 PM
HI all -

On a form I have an ADODC control and a DataBound control.
I wish to populate the DataBound control based on an Access
query. Since the query is large, I open it once in the
Form_Load routine and then filter it in the
Adodc1_MoveComplete event. Bits of the code:

Private myCN As ADODB.Connection
Private rsCustomers As New ADODB.Recordset
Dim custID As Variant

Private Sub Form_Load()

'open connection
SetConnection myCN, ADOconString

'open query
rsCustomers.Open "Select * From CustomersQuery", myCN, adOpenKeyset, adLockOptimistic

End Sub

Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

On Error Resume Next

If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Caption = "Record " & Adodc1.Recordset.AbsolutePosition & " of " & Adodc1.Recordset.RecordCount
Else
Adodc1.Caption = "Record 0 of 0"
End If

custID = Adodc1.Recordset.Fields("IdCUSTOMER").Value

rsCustomers.Filter = "IdCUSTOMER = " & custID

With dbcCustomer
Set .RowSource = rsCustomers
.ListField = "CUSTOMER"
.BoundColumn = "IdCUSTOMER"
End With

setDeudas

End Sub

The filter works correctly on rsCustomers, but dbcCustomer
all of the customers in the query and not just the fileterd
data. I have tried using the .ReFill and .Refresh methods
and get the same results. Why?