How to loop through the subform fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Form "JobFormA" and a Subform in it "JobFormB"

At certain situation arises (not always) that I have to move to each field
"Status" of the subform and set its value to "Posted". there are sometime 50
records in the subform and some time only few.

Therefore, I am planning to make a Command button and on Click event :
The cursor should move to first field of subform and set the field value to
"Posted" and continues to loop till end.

Please advise, what code should I write to do the above.
 
The simplest way to do this is to use an Update query directly on the
subform's table. This works regardless of any filter applied to the subform

This kind of thing:

Dim strSql As String
strSql = "UPDATE Table2 SET Status = 'Posted' WHERE Table2.FKID = " &
Me.[ID] & ";"
dbEngine(0)(0).Execute strSql, dbFailOnError
Me.[NameOfYourSubformControlHere].Form.Requery
 
Back
Top