PDA

View Full Version : Save and display data from 3 dependent combo boxes



oxicottin
02-18-2020, 03:22 AM
Hello, I'm having trouble understanding how to save data from my 3 combo boxes in form frmVWI (cboDepartment, cboCategories, cboSubcategories). If you look at the image the form uses (tbl_VWI) and I can save the data from cboSubcategories with SubcategoriesID but how do I save the others to my table tbl_VWI? what do I need to add to the tables and relationships to achieve this? I attached my relationship image and my DB broke down for the example.

OBP
02-18-2020, 07:02 AM
Looking at the Relationships it appears that you should be able to save the ApproverID as well as the Subcategories.
But the JobSteps are working the other way, ie the VW11ID is saved the the jobsteps table, which means it should be a Sub form displaying the data, which you have.
So what do you actually want the combos on your form to do, do you want to have the Department set the categories and the Categories set the sub categories?

oxicottin
02-18-2020, 09:47 AM
Looking at the Relationships it appears that you should be able to save the ApproverID as well as the Subcategories.
But the JobSteps are working the other way, ie the VW11ID is saved the the jobsteps table, which means it should be a Sub form displaying the data, which you have.
So what do you actually want the combos on your form to do, do you want to have the Department set the categories and the Categories set the sub categories?

On the form frmVWI If I were on lets say record 1 and selected a Department, Category and subcategory and the entire info into the detail section it would save it all and when I go back to record 1 it would display it once again. I think I have to add junction tables to my relationship but not understanding how.

OBP
02-18-2020, 10:51 AM
Is this what you mean?

oxicottin
02-18-2020, 11:23 AM
Is this what you mean?

Yes, I didn't think that was correct or normal so I didn't try that. I thought I had to make junction table. One issue though, on the second record it save the data but doesn't display the data? What is wrong with my cbo box row source?

OBP
02-18-2020, 11:39 AM
That is odd as my version maintains the second record OK.

oxicottin
02-19-2020, 02:57 AM
That is odd as my version maintains the second record OK.

The record shows the data only if I go directly to that record. So If I move to record 2 or 3 by first opening and selecting then only #1 displays everything and 2 & 3 only display department and data in detail section.

OBP
02-19-2020, 05:15 AM
When I closed the database and re-opened it I have the same problem.
I have added the fields that contain the IDs so that you can see that they have been saved in the table and show up on the form.
I have added requeries of the combos in the On current event.
But most improtant seems to be resetting the the Form to NOT Pop-up and NOT modal.

oxicottin
02-19-2020, 09:38 AM
OBP, I think you attached the old database.

OBP
02-19-2020, 10:36 AM
Sorry.

oxicottin
02-20-2020, 05:52 AM
Sorry.

That requery works in current.... Thanks!