Access 2007 - Issue with a combo box with dynamic row source
Posted on 2011-02-21
I've got a form that has a combo box where the user can select a project and a sub form (continuous form) showing expenditure data for the project selected in the combo box.
On sub form is tied to the parent form on ProjectID and in the 'afterUpdate' event of the project combo box, I set the selected project of the parent form to the ProjectID in the combo box and then I requery the sub form. So the result is that every time you change the combo box it changes the the expenditures shown in the sub form.
This works perfectly...
Now, in the sub form for each record I have 3 combo boxes and they are such that the first combo box's options are dependent upon the project selected, the second combo box's options are dependent upon the first combo box's selection, and the third combo box's options depend on the second combo box's selection.
So far I'm still working on getting the first combo box to populate correctly based on the change in project combo box in the parent form. I've got the row source of the first combo box set to this...
SELECT tbContractProject.ContractProjectID, tbContract.Name FROM tbContractProject INNER JOIN tbContract ON tbContractProject.ContractID=tbContract.ContractID WHERE (((tbContractProject.ProjectID)=Forms!frmExpenditure!ProjectID));
And every time the user changes the value in the project combo box in the parent form, I run some vba that does a requery on the first combo box which does effectively change the options in the first combo box. However when I then go to change one of the values in the first combo box I'm getting this message:
"The current field must match the join key '?' in the table that serves as the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the desired key value, and then make the entry with the desired join key in the 'many-only' table."
I don't understand what this means.
Any help trying to figure out this issue would be greatly appreciated. Thanks.