1 form for multiple inputs
I have a form named "frmInlogBAM" that is used as a menu. On this form I'm working with different sheets (or tab control if I remember). On Every sheet I have an action button that takes the user to the same form named "frmArtikel". The command buttons names are for exemple "cmdArtikelBA01", "cmdArtikelBA02", cmdArtikelBA05",... They are coming form the sheets "TabBA01", "TabBA02", "TabBA05",...
On the form "frmArtikel" that is used to input data in the table I have 3 fields: "ArtikelNumber", "ArtikelName" and "ArtikelDepartment".
Now what I would like to have is that when I use the cmdArtikelBA02 command button to go to the form, the ArtikelDepartment field of the "frmArtikel" form gets the default value BA02. If it's coming from the "cmdArtikelBA05" button it has to be BA05... The ArtikelDepartment field is locked, so the user can't change the value.
What I tried was putting
dim artOriginator as commandbutton
in a module, and then try to get this into the form "frmArtikel". On the action button that takes me to the form I use
set artOriginator = BA02 (also tried "BA02")
but when I do this I get an error.
I also use
set artOriginator = Nothing on the command button that takes me back from the "frmArtikel" form to the "frmInlogBAM" menu.
Does anyone know what I should change about the set artOriginator on the command button and what I should add on the "frmArtikel" on current event to make this work? (I guess I'll have to use the on current event...)