I'm using Access 2000 and I have a main form and a subform. When a
control on the subform is updated I am trying to update a control on
the mainform. But instead of updating the control on the main form's
current record, it updates the main form's control on every record.
This is the code I'm using for this:
Set cnn = CurrentProject. Connection
strSQL = "SELECT SUM(AmountPaid) AS SumAmountPaid FROM BillPayments
WHERE " & _
"BillingInforma tionSK = " & Me.Parent!SK & " AND ProjectSK = "
& _
Me.Parent!cboPr ojectSK & ";"
rst.Open strSQL, cnn, adOpenDynamic, adLockOptimisti c
' Fill in values on main form
Me.Parent!Amoun tsPaid = rst!SumAmountPa id
Me.Parent!Balan ceDue = Nz(Me.Parent!Am ountsPaid) -
Nz(Me.Parent!Am ountBilled)
So my question is how can I make this code only modify the controls on
the current record in the main form?
Any help would be appreciated.