Hello.
Quick question.
I have a work book that contains 15 different data entry user forms with some common field some not.
In order to keep the users on the straight and narrow I have introduced validation on certain fields in the user forms to ensure they put things in correctly (numbers/ excluded character, not black, etc..).
However, currently I have this code in each user form referenced by Me.<FieldName> = <Constraint> .
What I would like to do is neaten the whole thing up by, once they select generate, rather than having the code within each userform, have a public sub run that has all the validations in one place.
I am struggling with the references however, below is the code excert :
Public Sub VALIDATE_ALL()
If Me.U_DESC = "" Then
MsgBox ("You have not specified what work is required")
VALIDATE = True
End If
If Me.U_AVAIL = False Then
MsgBox ("PLEASE DO Not raise laboratory request unitl the samples are ready for submission.")
VALIDATE = True
End If
End sub
I have tried setting a global variable to the userform name (UFORMNAME) and replacing 'Me.' with this (doesnt work).
If I change the 'Me.' to specifically say the form name then it does work.
How can i dynamicaly set this to refer to the form in use (without using me. as the sub is in a module rather than embedded in the form)?
THanks.