On Change Update Subform

  • Thread starter Thread starter mattc66 via AccessMonster.com
  • Start date Start date
M

mattc66 via AccessMonster.com

I am trying to us the following code on a control in my main form, on the
Change Event. I want the changes to be applied to all the records in the
related subform. When I test it, nothing happens.

See below code - can anyone help?

Thanks
Matt

Private Sub AR_Matrix_Change()

Dim db As Database
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim sql As String
Dim varReturn As Variant

Set db = CurrentDb
Set rs1 = db.OpenRecordset("select * from tblOrderDetails where QuoteID =
" + CStr(quoteID))
Set rs2 = db.OpenRecordset("select * from tblOrder where QuoteID = " +
CStr(quoteID))

rs1.MoveFirst
While Not rs1.EOF
With rs1
rs1.Edit
rs1.Fields("AR_MATRIX") = rs2.Fields("AR_MATRIX")
rs1.Update
End With
rs1.MoveNext
Wend
Set rs1 = Nothing
Set rs2 = Nothing

End Sub
 
Oops it did work, but my record had not updated yet to reflect the change.
This brings up another question. I added me.refresh to the end of the code
below. When I do that I am only able to enter on character at a time in the
control before it runs the refresh. This makes it very hard to type. Any
suggests on what I could do?
 
Back
Top