daniness
Well-known member
- Joined
- Feb 12, 2010
- Messages
- 49
- Programming Experience
- Beginner
Hello All,
Can anyone please advise me on this:
I have 2 tables:
Locations
location_refnbr (pk)
location_name
office_refnbr (fk)
Offices
office_refnbr (pk)
office_name
On my first form, I have a combobox that is bound to the Locations table and displays all the different locations. Once a location is selected, a 2nd form is loaded which has textboxes which are also bound to the Locations table and are populated with the corresponding data.
Here's my issue: on the 2nd form, I have combobox that is bound to the Offices table. Currently, when this form loads all the available offices, displaying with the first office in the list. I need it to populate with the correct office based on the selection made on the combobox on the first form. I guess what I'm asking is, how does one bind a combobox to a foreign key b/c it is the foreign key, office_refnbr, from the Locations table that needs to display in the Office combobox.
I've tried a variety of bindings, including:
None of these are working and I've been ripping my hair out because of it. Could someone please advise?
Can anyone please advise me on this:
I have 2 tables:
Locations
location_refnbr (pk)
location_name
office_refnbr (fk)
Offices
office_refnbr (pk)
office_name
On my first form, I have a combobox that is bound to the Locations table and displays all the different locations. Once a location is selected, a 2nd form is loaded which has textboxes which are also bound to the Locations table and are populated with the corresponding data.
Here's my issue: on the 2nd form, I have combobox that is bound to the Offices table. Currently, when this form loads all the available offices, displaying with the first office in the list. I need it to populate with the correct office based on the selection made on the combobox on the first form. I guess what I'm asking is, how does one bind a combobox to a foreign key b/c it is the foreign key, office_refnbr, from the Locations table that needs to display in the Office combobox.
I've tried a variety of bindings, including:
VB.NET:
'Me.cboOffices.DataBindings.Add("text", frmEditDel.LocationsBindingSource, "office_refnbr")
'Me.cboOffices.DataBindings.Add("text", Me.OfficesBindingSource, "office_name")
'Me.cboOffices.DataBindings.Add("text", frmEditDel.LocationsBindingSource, "office_name")
'Me.cboOffices.DataBindings.Add("SelectedValue", Dos_DataSet.FKOfficesLocationsBindingsource, "office_refnbr")
'Me.cboOffices.DataBindings.Add("Selected Value", frmEditDel.LocationsBindingSource, "office_refnbr")
'Me.cboOffices.DataBindings.Add("Selected Value", Dos_trackDataSet.locations, "office_refnbr")
'Me.cboOffices.DataBindings.Add("ValueMember", Dos_trackDataSet.locations, "office_refnbr")