Combo Box results to Subform

H

Humbled Learner

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
 
J

Jeff Boyce

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top