I’m not 100% sure that this is an appropriate question for SO but here goes:
I’m trying to build a form in Access and I’m getting very confused.
I have 2 queries: “Jobs” and “Workers”, and a table of “Assignments”. I want to build an interface so that for a given Job, the user can look at different workers and assign them to the jobs. Once a worker has been selected for a job, a row should be added to the “Assignments” table linking the worker to that job. A job can have more than one worker and vice versa.
I think I need to set this up so that my main form has several subforms: “Jobs”, “Workers”, and “Assignments”. For whichever job is selected in “Jobs”, “Assignments” should list whichever workers have been assigned to that job. There will be an “Assign Worker” button below “Workers”, and an “Unassign Worker” button below “Assignments” that will remove a worker from the assignment list.
I understand what’s needed for the queries and VBA code behind the controls–I know how to have clicks and edits trigger events, because I’ve built a lot of Excel userforms. What I don’t know how to do is build this in Access using subforms, which seems to be the most direct approach. I guess I could work around that by just making a bunch of TextBoxes, but that seems like unnecessary work.
Any advice on how to build this form?
This can be set up with no code, or at worst, very little code.
Let us say your tables contain:
You will need:
The subform assignments should have a link child and master field JobID, the wizard will do this for you.
In place of WorkerID, put a combo box:
When you select a worker for the job, the job id will be filled in automatically, so you can add as many workers as you like.
The Northwind sample database has some examples of this type of thing.