The following code is customized to be triggered on multiple different forms. The various different criteria for the forms are in RED text. Can someone point me in the directions videos that will teach me how to reuse (call a procedure, function or module?) this code, as needed based on the "active" form? I want to eliminate the need of adding the button and customized code to each form. I want know what form is open and active and which code is needs to process.
cmdUpdate button:
Private SubcmdUpdate_Click()
Dim strSQL As String
strSQL ="UPDATE Students SET Students.UpdateWorkshop = -1 "
strSQL = strSQL& "WHERE Students.[ID] IN "
strSQL = strSQL& "(SELECT TOP " & CLng(Me.Textbox1) & " [ID] FROMStudents As S "
strSQL = strSQL& "WHERE (NZ(S.UpdateWorkshop, 0) = 0) AND (S.Major In ('BADM','PBA')) "
strSQL = strSQL& "AND (S.Session = " &Val([Forms]![WorkshopsSession]![SessionCombo] & "") &"));"
'DoCmd.Requery