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

Advice wanted: Populating subform based on criteria in main form

Status
Not open for further replies.
Mar 24, 2008
2
US
Hello:

I have a main form with a subform dealing with vehicle maintenance. Based on different combinations of 4 values in the main form, I would like to populate the subform with one of over 70 different checklists. The checklist forms never change and are for print purposes only. The 4 values in the main form each have different selections available: StockNumber (can be one of over 200 vehicles), MaintenanceLevel (6 choices), ConditionCode (9 choices), and StorageMode (2 choices).

My question: Would it be possible to auto-populate the sub based on the values resident in the main? I began writing a lengthy If/Then statement on the OnCurrent property and became terribly lost. There are too many combinations and my VBA skills are dangerous at best. Is there a simpler way? Or should I just create a cbo box on the main listing the 70 checklists and let its value dictate which checklist pops up in the sub? The latter would task the Production Controller with populating the correct checklist before the form is printed and assigned to a maintenance crew.

Auto-population of the sub would be the preferred option.

Thanks,
Mark
 
What is a "check list"? Is this a subset of records in a table or an unbound subform?

Why would you use the "OnCurrent" property? It didn't understand the main form was bound.

Duane
Hook'D on Access
MS Access MVP
 
Thanks for your reply. The checklists are simply forms listing any number of steps to be completed by the Maintenance crew. They never change, but there are 70 different forms.

I scrapped the "OnCurrent" property idea. I did put a combo box on the main form where the user can select one of the 70 checklists. It populates the subform on the "After Update" property. The problem now is that the subform shows the same checklist on every record. How would I keep the checklist bound to the current record? I'm sure it deals with a parent/child relationship of a key field in the main form with the same field on the sub. The problem there is that the sub is displayed in datasheet.
 
You can have a subform display as a datasheet and set its Link Master/Child properties.

If you need additional assistance, please provide some information about your table structures and specifications. I still don't understand why 70 forms. Is there a table or record source of these forms?



Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top