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

Use Main Form to Restrict Products on Subform

Status
Not open for further replies.

TSimonick

Technical User
Sep 6, 2001
39
US
Hi,

I want to put a combo box on a main form that will restrict the products that are available for ordering on a subform. Using the Northwind example, the Order form would have a Suppliers combo box so that when you move to the Order Details subform to choose products for the new order, only those from a single supplier are available. Can you do this without writing code?

TIA!!
 
You can do this without code, but I would rather use VB. Make the RecordSource for your subforms SourceObject have a qry that filters by the value of the combo column that you want. You can do this all by using the 'builder' functionality on the property sheet.

Of course you will still need to write some code for the 'AfterUpdate' event on the combo.

Me.subfrm.Requery

Let me know if you want the method to code it.

Good Luck!


John Pasko
john@rts-sd.com
"No matter where you go, there you are."
 
John,

Thank you for your help. I did try a parameter query (qfltSuppliers) to filter using as the criteria the Supplier in the cbo: [Forms]![Orders]![cboSuppliers]and the AfterUpdate event in the cbo was Applyfilter qfltSuppliers.

If I follow your instructions, I should have used my query as a record source, but put your code (above) into a macro or as a VB program. Would you please help me on this point and show me how you would do it with VB code? It will be my intro to VB.

Thanks again for your help!!

Tom
 
Tom:

I'd be happy to help out. What is the SourceObject for the subfrm and where do you have qfltSuppliers? If you want we can continue via email.

Regards,

John John Pasko
john@rts-sd.com
"No matter where you go, there you are."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top