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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Questions on forms with a subform

Status
Not open for further replies.

jeprox

Technical User
Aug 3, 2001
12
0
0
US
Im creating a form with a subform in a table format. What Im trying to do is specify what records I want to show using a combo box. So if I want just all records from CA to pop out, I will pick this from my combo box and the subform will just display the record that have CA. How do I do this?

Thanks.
 
In the control source of your subform enter the code to
pull the initial recordset.

SELECT FieldName FROM YourTable WHERE....;

Then, in the On Change of the combo box, enter this:

Me![YourSubform].Form.Requery

or if your control source for the subform is initially a table, then in the On Change of the combo box, you will need to enter code that will update the recordsource of the subform.

Like below:

Me![YourSubform].Form.RecordSource = "SELECT YourField1, YourField2 FROM YourTable WHERE (((YourField1) Like [Forms]![YourForm]![YourComboField]))"

hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top