Call a subform based on Main Form's value

amanco

Registered User.
Local time
Today, 14:36
Joined
May 10, 2004
Messages
53
i have a "main form" which is continous.

when i choose data from the dropdown menu in the main form. i would like to call the subform that is related.

there are 50 values in the drop down menu linked to 50 subforms. so i think the invisible doesnt work well for appearance purposes.

any idea what the best idea i could do for this?

cheers :)
 
G’day Amanco.

Can’t say if this is the best way to do it but it is one way to do it.

A97 demo attached which has 9 sub forms.

Hope it helps or at least gives you some ideas.

Regards,
Chris.
 

Attachments

Thanks

Thank you ChrisO, nice example :)

Do you know how can edit this so more than 1 subform can appear.

for example: Main Form:

cbo1 = 1
cbo2 = 2
cbo3 = 3
cbo4 = 4
...... = ...
cbo50 = 50

and since this is continous form so i'll be adding more than 1 cbo value.

so when i choose the values: cbo1,3,50
i get subforms 1,3,50 in the same order continously.

thanks again for the file :)
 
G’day Amanco.

I must get this straight in my own mind first, and that is difficult. :(

It looks like you require the user to make multiple, random, selections from the Main continuous form.

Then the ‘selected sub forms are displayed’ XOR become ‘available for display’.

If ‘selected sub forms are displayed’ then you will run out of screen real estate to display them.
If ‘available for display’ then that could be arranged, all though I have never done it.

Assuming you do not want to display a possible 50 sub forms at the same time I’ll go for my second suggestion…display in sequence.

First thoughts are that the main continuous form is based on a table and that table has a check box field called, maybe, DisplayThis. It defaults to False on form open, maybe yes maybe no, and the user selects the forms that should be displayed in sequence.

As they click forward or backward buttons, each selected sub form is display singularly and in sequence.

Please advise if my understanding is correct, and if not then what you had in mind.

Regards,
Chris.
 
Last edited:
ChrisO said:
G’day Amanco.

I must get this straight in my own mind first, and that is difficult. :(

It looks like you require the user to make multiple, random, selections from the Main continuous form.

Then the ‘selected sub forms are displayed’ XOR become ‘available for display’.

If ‘selected sub forms are displayed’ then you will run out of screen real estate to display them.
If ‘available for display’ then that could be arranged, all though I have never done it.

Assuming you do not want to display a possible 50 sub forms at the same time I’ll go for my second suggestion…display in sequence.

First thoughts are that the main continuous form is based on a table and that table has a check box field called, maybe, DisplayThis. It defaults to False on form open, maybe yes maybe no, and the user selects the forms that should be displayed in sequence.

As they click forward or backward buttons, each selected sub form is display singularly and in sequence.

Please advise if my understanding is correct, and if not then what you had in mind.

Regards,
Chris.

thanks for the reply Chris

i like your idea about having the "Back and Next" and i constructed these forms to help you understand the picture.

in here cbo1 and cbo 3 were chosen, so when i click the second tab, i see cbo1 subform waiting for me and when i click next button cbo3 will be next. appreciate your time, thank you :)
 

Attachments

G’day Amamco.

Still not sure about the final result required but a small A97 demo is attached.

To try and simplify things I got rid of the combo boxes and replaced them with a single multi select list box.

The sub form switching is done directly out of the selected items in the list box, via an array, but there is no linking to the main form at this stage. If that is required then the link criteria would need to be added to the table and be picked up on change.

That is my understanding at the moment, please advise if that it incorrect.

Regards,
Chris.
 

Attachments

ChrisO said:
G’day Amamco.

Still not sure about the final result required but a small A97 demo is attached.

To try and simplify things I got rid of the combo boxes and replaced them with a single multi select list box.

The sub form switching is done directly out of the selected items in the list box, via an array, but there is no linking to the main form at this stage. If that is required then the link criteria would need to be added to the table and be picked up on change.

That is my understanding at the moment, please advise if that it incorrect.

Regards,
Chris.

Wow Chris you are my hero :)

very nice demo.

if i may ask how can you add the link criteria for the main form.
also in choosing from the list box and clicking next. this will bring the forms in sequence but not in Clicking-sequence, for e.g. when you choose the last one then choose the first one and click next, it will bring the 1st one form 1st. instead of the last one's form which was chosen 1st. as in the combo box the values are randomly chosen.

please be patient with me as i am a newbie when it comes to VBA. it's looking great so far. and thank you for your time.

cheers
 
Clicking-sequence???

I would not even suggest going down that path.

Given the above data, play this little mental game….

One of 50 possible selections, all chosen at random…
Select each one at random till all 50 are chosen…
Now state from memory the sequence of choice from all 50.

A computer can…but what of the operator?

Regards,
Chris.
 
I failed to answer one of your questions.

Hope the attached A97 demo does the trick.

Regards,
Chris.
 

Attachments

ChrisO said:
Clicking-sequence???

I would not even suggest going down that path.

Given the above data, play this little mental game….

One of 50 possible selections, all chosen at random…
Select each one at random till all 50 are chosen…
Now state from memory the sequence of choice from all 50.

A computer can…but what of the operator?

Regards,
Chris.

Thank you sir for your reply.

i can't question your experience in this field ;)

so i thought of another way to sort these in the subforms view. basically in the combobox in the main form, i'll be recording Patient's symptoms chronologically. so the use of "date field" will be tied to the chosen symptom. this means the first chosen symptom "cbo1_date" > "cbo2_date" > "cbo3_date" > ....

where cbo_date = Date() - cbo_date
and the larger cbo_date value the 1st its subform should be encountered.

just a thought Sir, i am not sure if this could be done.

regarding the new demo, it's working like charm. i'll implement it fully and let you know about the results. thank you so much for your time :)
 
G’day Amanco.

First up let me say there were errors in the manipulation of the array.
(It worked but more by good luck than good management. :o )

The array has been fixed and should be a little easier to understand.
Another field, SymptomEntryDate, has been added to the table and the list box is now sorted descending on that date.
A 'select all' button has been added to allow quick filling the array.

Hope it works OK.

There does however seem to be a problem of structure here.
Should this not be a one-many relationship with the Patient on the one side and symptoms on the many? It seems the logical way to go and could remove the need for all, bar one, of the sub forms.

Just guessing here because I don’t know the facts.

Anyhow, as it stands, version 3 is attached.

Regards,
Chris.
 

Attachments

Users who are viewing this thread

Back
Top Bottom