The thread linked in post #5 provides code for two procedures.



Private Sub btnLoginSample_Click()
is located behind the form that has command button named btnLoginSample

Public Function GetNewLabNumber()
is a function located in a general Module
it is in a general Module because it is called from several procedures, one of which is the above btnLoginSample_Click