Any event running on form refresh for every record?

  • Thread starter Thread starter Max Moor
  • Start date Start date
M

Max Moor

Hi All,
I have a couple textboxes I'd like updated when a continuous forms
form refreshes. The value to put in them is based on another, bound box's
value. I don't want to put the calculation in as a control source, because
then I can't edit the box. I figure I can update the value in code, but I
need an event that runs for each record on the form's refresh. Can anyone
give me any thoughts?

- Max
 
Generic code step to set the value of a textbox:

Me.TextBoxName.Value = Me.OtherTextBox.Value + 1
 
Generic code step to set the value of a textbox:

Me.TextBoxName.Value = Me.OtherTextBox.Value + 1

Hi Ken,
I've got that part. The problem is, where do I put that code so that
it gets run for each individual record. I thought to put it in an
AfterUpdate event, but AfterUpdate doesn't seem to get called just by
refreshing the form (like when it's first opened, or requeried).
 
You can loop through all the records this way:

DoCmd.Echo False
Me.Recordset.MoveFirst
Do While Me.Recordset.EOF = False
Me.TextBoxName.Value = Me.OtherTextBoxName.Value + 1
Me.Recordset.MoveNext
Loop
Me.Recordset.MoveFirst
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top