View Full Version : Action for all Records


Rosebud
03-27-2001, 08:54 AM
Hi,

I am trying to perform an action for each record on a form. I have my code in the OnCurrent event, but when the form opens, the oncurrent event only runs for the first record, not the rest. The code is run for the rest only when I click on that record. Where do I have to put my code so that when the form opens, the code is automatically run for each record?

KevinM
03-27-2001, 01:34 PM
You need to loop through your records in your code.

Post more details and your code.

Kevin M

Pat Hartman
03-27-2001, 06:00 PM
If you are trying to update all of the rows in a table, you should use an update query.

Rosebud
03-28-2001, 05:41 AM
Thanks Kevin and Pat.

Kevin, you were right, that's what I had to and I figured it out yesterday. What I did was counted the number of records in Me.Recordset, moved to the first record, performed the code, moved to the next record, and looped it all over again:

Set rst = Me.Recordset
rst.movelast
x=rst.recordcount
rst.movefirst

For indx = 1 to x Step 1
CODE
rst.Movenext
Next indx

Something like that, and it worked. Thanks again. (I wasn't trying to update all the rows, just doing heavy code)