I created a subfrm ("subfrm1") wit a couple of textboxes on it.
I added this subform on a form ("mainfrm").
Afterwards I copied and pasted it on the same subform. This second instance I called "subfrm2".
What I want to achieve is that when clicking on a textbox, I can retrieve following information :
- the name of the clicked textbox
- the name of the subform where that textbox belongs to
- the name of the mainform where that subform belongs to
Till now, when clicking on a textbox (no matter on which subform, I always get "subfrm1".
OK, I wanted to spare you the details, but if you insist ....
We want a planningtool.
- we have 13 machines.
- each machine should run daily (7 days a week)
- every day we have 3 shifts
- each machine has 5 operators (with different skills)
We want an overview of a week with 7 days and 3 shifts each day for all machines. Using the planningtool the shiftleader can assign people to a certain function on a certain machine for the selected day.
I give you an example : when the shiftleader has an empty weekoverview, he should click on a textbox. Depending on the checkbox I can retrieve its name which tells me the weekday and the shiftnumber. So I know now which team is working on that moment of the day / week.
This textbox belongs to a subform called "FunctionX" and that subform belongs to a form "MachineX" (where the X stand for the function- or machinenumber). Now I (want to) know for which machine and which function I need an operator.
I query the DB and select an operator who might operate the specified machine in the specified function and who is working at the specified day and the specified shift.
No matter what textbox you click, always the same code should be executed. The only thing that makes a difference are the parameters which I retrieve from the names of the objects (textbox, subform and form).
Because there are 7 days in a week and 3 shifts every day, I need 21 objects.
But this for each machine : so 13 * 21 = 273.
But this for 5 functions on each machine : so 273 * 5 = 1365
I need 1365 objects I need to have it all covered.
First of all this is way behind the limits of access.
Secondly I don't like typing 1365 times the same code.
Therefore I was thinking of creating a subform for just one function (just containing 7 * 3 = 21 objects) and write code for each textbox.
I then put this subform 5 times (for each function on a machine) in a parentform. Finally I put that parentform 13 times on my mainform (for each machine).
And I was hoping to have my issue solved.
An alternative is to create a subform and copy it as much as I need in the database explorer, but then I have a lot of subforms; which I want to avoid if I could solve this in an other way.
Hope you get the picture and maybe a brilliant idea.