If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo Box results to Subform
I created a form with a combo box (names)
The form has a suboform, (orders subform) When I select a name from the form, the subform reports only those rows attached to that name. My problem is... when you open the form and the combo box is blank, but the subform shows all rows attached to the first name. Can I make the subform blank until a name is chosen, or can I have the subform show all rows until a name is chosen. The combo box reflects: After Update: Option Compare Database Private Sub Combo4_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[NameID] = " & Str(Nz(Me![Combo4], 0)) If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub Thank You |
#2
|
|||
|
|||
Combo Box results to Subform
If your subform is based on a query, and if that query is based on the value
selected, then you won't have any value select (and hence, no subform records) until the select is made in the combobox. You'll need to requery after the selection is made (use the AfterUpdate event of the combobox). Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or psuedocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Humbled Learner" wrote in message ... I created a form with a combo box (names) The form has a suboform, (orders subform) When I select a name from the form, the subform reports only those rows attached to that name. My problem is... when you open the form and the combo box is blank, but the subform shows all rows attached to the first name. Can I make the subform blank until a name is chosen, or can I have the subform show all rows until a name is chosen. The combo box reflects: After Update: Option Compare Database Private Sub Combo4_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[NameID] = " & Str(Nz(Me![Combo4], 0)) If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub Thank You |
Thread Tools | |
Display Modes | |
|
|