Create a form with dynamic number of tab?

jamesave

New member
Local time
Yesterday, 22:39
Joined
Apr 26, 2020
Messages
26
Let's say I have an order form. I'd like to have an subform in that form where it will dynamically tab pages with the number of items from that order form. Is this possible? the order form has a limit (up to four) entries. Each of the tab will then have same detailed pages, just different product at the order form.

If it's not possible, then maybe I create a pop up form if user need to get more detail info.
 
You would usually include as many tab pages you'll ever need and simply show only the ones you need for a particular case and hide the rest.
 
bad design on my opinion.
you're just making too much cosmetics when you can
have it listed.
 
The tab control is not intended to be sensitive to data. They are designed as fixed views generally showing different kinds of data on each tab. So, the customer form might have three tabs. One for demographic information. One to list past/open orders. and One to list contacts. Tab pages are limited (I don't know the max) but they are not bound. That is why you cannot do what you are trying to do unless you can write the code to support the requirement. Keep in mind that today there may never be more than four items on an order but tomorrow there could be 12. Businesses change. Do NOT create applications with fixed limits like this. Once you have more than one of something, you have many and many can be infinite no mater what the user tells you today. Any business would be happy to grow their product line to attract more customers. Do not create unnecessary limits - EVER.
 
Why not use a subform? Either continuous or if a lot of data, single and use the navigation button to go ‘left/right’ or make your own
 
The problem with a "dynamic number of tabs" is that if you actually DO create a new tab control, over a period of repeated use you would run into the form's "lifetime limit" on created controls. It used to be a little less than 800 controls, though newer versions of Access have somewhat increased that limit. In any case, at some point in the future, creating that dynamic tab control would trigger an error.

I would go with a "continuous sub-form" approach which would allow you to scroll through the sub-form to see what is in it. However, you have other perfectly good suggestions.
 
@jamesave esave. Although others have discouraged this approach if you want to do it, it is very easy to do. I do not see much of an issue. Only requires a single subform and a tab with a "large" amount of tabs to handle the max possible.

The OP stated there will be a max of 4 items per order so they will not need to dynamically create controls.


1. Build the main form
2. Build a subform for items
3. Build the tab control. Add a reasonable amount of tabs.
5. Add the items subform but do not embed it in the page. Instead float it over top of the tab control.
6. On the main forms current event. Configure the tabs by reading the number of child records. Show the appropriate amount of child records and label the tabs.
7. On the tabs change event filter the subform based on which tab is showing.
add a unbound textbox on the main form. Link the subform control to the unbound text box.
When change the tab set the value of the textbox to the correct record and the subform will filter to that.

This example can do up to 20 Partners in a firm.

firm.PNG
 

Attachments

Users who are viewing this thread

Back
Top Bottom