I am trying to update a control in a subform. Actually I am calculating the number of months. here is the code: (which doesn't work!)
While (Not Me.Form.Recordset.EOF)
months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months
Me.Form.Recordset.MoveNext
Wend
the error i get is: "this action was cancelled by an associated object" on the line Me.Form.Recordset.MoveNext
could someone please help me out here?? thanks!
Just put this part of your code in the form's BeforeUpdate event:
months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months
I do think you could shorten your code to this:
Me.[number of months] = Round((Me.End - Me.Start) / 30, 0)