Multiple Subforms and Arrays

S

Steve S

2 part question.

I need to develop a form with multiple subforms - SF1, SF2,,up to SF4. Each
subform will have 5 fields. Can I use the same underlying form in all
subforms? Or do I have to create 4 identical forms - one to use in each
subform? The main form will look like an array for the user to select values
for each element.

second part. How do I link a form to an array? Is this possible?
 
G

Graham Mandeno

Hi Steve

1. Yes, you may simultaneously use the same form as the SourceObject for
multiple subform controls. Each instance can have a different RecordSource
assigned to it at runtime, or can be linked to its main form by different
master/child link fields.

2. You cannot bind a form to an array. The easiest way to simulate this is
by creating a temporary table. You can also use a "disconnected"
ADODB.Recordset (you can Google for lots of examples of doing this). If you
use a temporary table, I recommend creating it in a separate MDB file and
linking it to your frontend database. Creating temp tables in your frontend
is a bad idea because it contributes to database bloat and increases chances
of corruption.
 
S

Steve S

Graham, many thanks.

I had tried that before but while in design mode the second, third,,,
instances of the subform were blank. I tried it again after you verified it
should work and when I switched from design to form view the same form
appeared in every subform. I guess that makes since because you only need to
see the underlying form once to make changes.

I will use your suggestion about a disconnected table


Thanks again.
--
Steve S


Graham Mandeno said:
Hi Steve

1. Yes, you may simultaneously use the same form as the SourceObject for
multiple subform controls. Each instance can have a different RecordSource
assigned to it at runtime, or can be linked to its main form by different
master/child link fields.

2. You cannot bind a form to an array. The easiest way to simulate this is
by creating a temporary table. You can also use a "disconnected"
ADODB.Recordset (you can Google for lots of examples of doing this). If you
use a temporary table, I recommend creating it in a separate MDB file and
linking it to your frontend database. Creating temp tables in your frontend
is a bad idea because it contributes to database bloat and increases chances
of corruption.

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Steve S said:
2 part question.

I need to develop a form with multiple subforms - SF1, SF2,,up to SF4.
Each
subform will have 5 fields. Can I use the same underlying form in all
subforms? Or do I have to create 4 identical forms - one to use in each
subform? The main form will look like an array for the user to select
values
for each element.

second part. How do I link a form to an array? Is this possible?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top