PDA

Click to See Complete Forum and Search --> : Problem with ADO data control


Psyrus
Jul 15th, 2000, 11:25 AM
Hello,


I am having the following error popup:

'Cannot find item in the collection' or something similar.

What I am trying to do is:

************************************************************
Private Sub txtQuantity_LostFocus(Index As Integer)

'Set the total cost value which is txtQuantity * Unitprice

Dim CostTemp As Variant

CostTemp = (txtQuantity(Index) * AdodcProdID.Recordset.Fields.Item(Index))
txtTotalCost(Index) = FormatCurrency(CostTemp)

End Sub
************************************************************

What I am trying to do is when the Quantity textbox (which is a control array) loses focus, the totalcost textbox(which also is a control array) is assigned the value of the quantity textbox * the UnitPrice. The AdodcProID recordset consists of just the UnitPrice(SELECT UnitPrice FROM Products). How do I iterate through this recordset(ie. how do I get the value out of each row)? The first time it works,where index has the value of 0, but after the second texbox loses focus I get that error.