I have a macro and a couple of userforms which works thus:
1) User enters information about sickness into a userform
2) Clicking okay, the userform does some validation checks to make sure they haven't missed any compulsory fields.
3) If everything is okay, it transfers this info to another userform, which is used to compose an email to distribute this information to the relevant supervisors.
The problem I have is that if everything isn't working okay, I need a way of passing that information back into the subroutine that called the form, so that it can halt the code before it closes the form (and brings up the second one).
I thought I had solved this.
The form is called:
And I inserted on the 'OK' button the code:
But when the system returns to the subroutine, the value stored in the 'Tag' property has disappeared and frmReportSickness.Tag is a "null" value.
Any ideas why? Or how I could do this better? I would prefer not to resort to sticking variables in random cells if possible.
Chris
1) User enters information about sickness into a userform
2) Clicking okay, the userform does some validation checks to make sure they haven't missed any compulsory fields.
3) If everything is okay, it transfers this info to another userform, which is used to compose an email to distribute this information to the relevant supervisors.
The problem I have is that if everything isn't working okay, I need a way of passing that information back into the subroutine that called the form, so that it can halt the code before it closes the form (and brings up the second one).
I thought I had solved this.
The form is called:
Code:
frmReportSickness.Show
And I inserted on the 'OK' button the code:
Code:
If ResumptionValid = False Then
frmReportSickness.Tag = 1
Unload Me
Exit Sub
Else
frmReportSickness.Tag = 0
End if
But when the system returns to the subroutine, the value stored in the 'Tag' property has disappeared and frmReportSickness.Tag is a "null" value.
Any ideas why? Or how I could do this better? I would prefer not to resort to sticking variables in random cells if possible.
Chris