I want to nest an update query inside a Do Loop. I am not sure which loop is the best for this.
The user will enter a number in a textbox and then an update will run until the value in the textbook is reached. This Query is to run to select records by checking a box (title is update) in a subform. I would rather have a module that I can use on multiple forms and subforms and not have to create code for each form.
I am picturing some code like this
Private Sub Text27_Afterupdate()
i = Textbox value
Do Until i>[Textbook value] 'Condition is False.Hence loop will be executed
UPDATE Students SET Students.UpdateWorkshop = Yes
WHERE (((Students.UpdateWorkshop)=No) AND ((Students.Major)="BADM" Or (Students.Major)="PBA") AND ((Students.Workshop) Is Null) AND ((Students.Session)=[Forms]![WorkshopsSession]![SessionCombo]));
i = i + 1
Loop
End Sub
I am a newbie to Do Until loops
The user will enter a number in a textbox and then an update will run until the value in the textbook is reached. This Query is to run to select records by checking a box (title is update) in a subform. I would rather have a module that I can use on multiple forms and subforms and not have to create code for each form.
I am picturing some code like this
Private Sub Text27_Afterupdate()
i = Textbox value
Do Until i>[Textbook value] 'Condition is False.Hence loop will be executed
UPDATE Students SET Students.UpdateWorkshop = Yes
WHERE (((Students.UpdateWorkshop)=No) AND ((Students.Major)="BADM" Or (Students.Major)="PBA") AND ((Students.Workshop) Is Null) AND ((Students.Session)=[Forms]![WorkshopsSession]![SessionCombo]));
i = i + 1
Loop
End Sub
I am a newbie to Do Until loops