Help storing multiple values (with a junction boxes)

cnstarz

Registered User.
Local time
Today, 00:17
Joined
Mar 7, 2013
Messages
89
In my database (attached), I need to be able to store multiple notes for tasks performed in various cities -- each note has a small description (more on that at the bottom of this post). For the "San Antonio, TX" task, notes "Heartbleed" and "BAT Scan" apply. From what I understand, this is a many-to-many relationship which will require the use of a junction box. My structure is like this:

tbTasks
TaskID (PK - autonumber)
Task

tbNotes
NotesID (PK - autonumber)
Notes
Details

jcttbTaskNotes
TaskID (FK from tbTasks)
NotesID ( FK from tbNotes)

My mainform (fmTasks) is based off the tbTasks table; my subform (subfmTaskNotes -- continous form) is based off the jcttbTaskNotes junction table. The Master/Child link for the subform control is TaskID. In the subform I have a combo box bound to the NotesID field in the junction table that allows me to choose a note. Everything so far works great -- I can assign multiple notes to a task.

My problem: I also have a "Details" text box in the subform that I want to be populated with the description of the Note selected in the combobox mentioned above. For example: if I choose the "Heartbleed" note, then I want that "Details" field to be populated with "Mitigate vulnerability associated with CVE-2014-0160". I assume it has to be somehow tied to the "Details" field of the tbNotes table, but I have no idea how to implement that.

Overall, am I going about this the right way? How do I get the Details text box to display the details for each note? Thanks for your help!
 

Attachments

Figured it out! I was able to base the subform (subfmTaskNotes) off a new query:

quTaskNotes
Field:jcttbTaskNotes.*
Table: jcttbTaskNotes

Field: Details
Table: tbNotes

Field: Task
Table: tbTasks
Sort: Ascending

Then, in the subform, I set the control source for the "Notes" combobox (cboNotes) and the "Details" text box (txtDetails) to NotesID and Details, respectively.

Please let me know if there is a more efficient way of accomplishing this. Thanks!
 

Attachments

Users who are viewing this thread

Back
Top Bottom