Alright, it's easy once you know how, but it takes a bit more effort. The easiest way is to have one text box on your main form which will identify every field on your subform(i.e. Primary Key field on the main form which relates to the Foreign Key field of the Subform. This is why I use Autonums in every table; it's a cheap, easy way to relate data, but that's a whole 'nother debate).
Now, what you're looking to do is Update the two fields in the underlying table to the two fields in the combo box where the table's foreign key is equal to the Main Form's Primary Key. There's about a million ways to do this (ADO, DAO, RunSQL, etc.) but probably the least code intensive is going to be to use a predefined Update Query.
-Open a new query
-Select Update Query under queries
-Pull in the table that is to be Updated
-Pull down the two fields to be Updated.
-In the 'Update to' Section, for MSO, type:
Code:
Forms!Your_Form_Name.Form!Your_Combobox.Column(0)
or whichever column number it's to be Updated to, substituting my generic names with the literal names of your form and combo box objects.
-for [K ID], type:
Code:
Forms!Your_Form_Name.Form!Your_combobox.Column(1)
Make sure that you have the right Combo Box column # or you're going to be Updating your fields with the wrong data.
-You're now going to need a 'Where' Clause so that you limit the Updating only to records which are currently being displayed on the Subform. You would use the Primary Key of the Main form for this:
-Pull down the Foreign Key field in your query. Leave 'Update To' blank as you're not going to actually be updating this field. In the 'Where' Section of this field, you'd type:
Code:
Forms!Your_Form.Form! Your_Form_Primary_Key
This is extremely important as, without a Where Clause, you're going to end up Updating every field in the table to the two fields in the Combo Box!
So now your query's finished. Save it. Finally, you want to call this Query in the AfterUpdate event of your combo box:
Code:
Your_Combo_AfterUpdate()
DoCmd.OpenQuery "Your_Query_That_You_Just_Wrote", acViewNormal
Forms!Your_Main_Form!Your_Subform.Requery
End Sub
The 'Requery' code at the end will ensure that, after the Update Query is run, your subform will visually reflect the Updates that you just made.
You may also want to take of Access's built in Warnings by:
Code:
Your_Combo_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.OpenQuery "Your_Query_That_You_Just_Wrote", acViewNormal
DoCmd.SetWarnings True
Forms!Your_Main_Form!Your_Subform.Requery
End Sub
I know that this is a lot to take in; if you still need help, just send me your db and I'll do it for you so that you can see what's going on first-hand.