Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need combo box data to update when row selected

Status
Not open for further replies.

jcfraun

Technical User
Dec 13, 2008
51
US
I have a form: FRM – AddAttributesMainFormTest (Single Form View)
that has a subform: FRM – AddAttributesTest (Datasheet View)

The record source for the main form is:
SELECT DISTINCT [TBL - PossibleAttsforItemsWithoutAtts].Page, [TBL - PossibleAttsforItemsWithoutAtts].[Proper Name], [TBL - PossibleAttsforItemsWithoutAtts].Item, [TBL - PossibleAttsforItemsWithoutAtts].Stage FROM [TBL - PossibleAttsforItemsWithoutAtts] ORDER BY [TBL - PossibleAttsforItemsWithoutAtts].Page, [TBL - PossibleAttsforItemsWithoutAtts].[Proper Name];

The record source for the subform is:

SELECT [TBL - PossibleAttsforItemsWithoutAtts].Item, [TBL - PossibleAttsforItemsWithoutAtts].Attribute, [TBL - PossibleAttsforItemsWithoutAtts].Value, [TBL - PossibleAttsforItemsWithoutAtts].[Add?] FROM [TBL - PossibleAttsforItemsWithoutAtts];


The subform is linked to the main form through Item.

This all works great when I have the data in text boxes.

Now I want to convert the Value field on the subform to a combo box and I want it only to give me the values in a query that are associated with the attribute shown in the text box. So, the row source is:
SELECT [QRY-DistinctAttsVals].Value, [QRY-DistinctAttsVals].Attribute FROM [QRY-DistinctAttsVals] WHERE ((([QRY-DistinctAttsVals].Attribute)=Forms![FRM - AddAttributesMainFormTest]![FRM - AddAttributesTest].Form!Attribute));

It actually works well, but doesn’t update when I click on the row. If I go in and out of design view, it works (i.e., updates). I know I need an event procedure, but just can’t get any to work. Here’s what I currently have for the subform:

Private Sub Form_GotFocus()
Forms![FRM - AddAttributesMainFormTest]![FRM - AddAttributesTest].Form.Requery
End Sub

Any ideas?
 
OK, well I tried adding Value.Requery to the event On Enter and it worked. Sorry for the false alarm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top