Using form input to set number of rows in subform?

  • Thread starter DominicGreco via AccessMonster.com
  • Start date
D

DominicGreco via AccessMonster.com

I have a simple form that describes a structure. The structure has a ID
number like "A-1". In the main table I've called this field "Struct_num".
This structure can have one or more "truss" sections. On the main form the
user enters the number of truss sections in a text box. For each of these
truss sections, I need to know the length (span) in feet. So I set up table
called "Truss" with the fields "truss_num" and "span".

I then used the wizard to construct a form for the table "Truss" using the
Datasheet configuration. This form was inserted as a SubForm in the main form.
The fields "struct_num" and "truss_num" were linked/associated between form
and subform

I'd like it so that when the user enters the number of truss sections in the
main form, the subform would featured the same amount of rows. For example:
user enters "3". the subform is then populated with 3 rows numbered 1,2, & 3.
In addition, the subform would not allow any more rows that the number of
truss sections.

Can anyone help me on this?
 
M

Michael Gramelspacher

I have a simple form that describes a structure. The structure has a ID
number like "A-1". In the main table I've called this field "Struct_num".
This structure can have one or more "truss" sections. On the main form the
user enters the number of truss sections in a text box. For each of these
truss sections, I need to know the length (span) in feet. So I set up table
called "Truss" with the fields "truss_num" and "span".

I then used the wizard to construct a form for the table "Truss" using the
Datasheet configuration. This form was inserted as a SubForm in the main form.
The fields "struct_num" and "truss_num" were linked/associated between form
and subform

I'd like it so that when the user enters the number of truss sections in the
main form, the subform would featured the same amount of rows. For example:
user enters "3". the subform is then populated with 3 rows numbered 1,2, & 3.
In addition, the subform would not allow any more rows that the number of
truss sections.

Can anyone help me on this?

Does this describe your tables structure?

CREATE TABLE Structures
(struct_num VARCHAR (10) NOT NULL PRIMARY KEY);

CREATE TABLE Trusses
(truss_num VARCHAR (10) NOT NULL PRIMARY KEY,
span_len DECIMAL (6,2) NOT NULL);

CREATE TABLE StructureTrusses
(struct_num VARCHAR (10) NOT NULL REFENENCES Structures (struct_num),
truss_num VARCHAR (10) NOT NULL REFERENCES Trusses (truss_num),
required_amt INTEGER NOT NULL,
PRIMARY KEY (struct_num, truss_num));


You could have a structure that used 12 24-foot trusses and 6 18-foot trusses.
That would be two rows in table StructureTrusses.

Main form is based on the table Structures, and the subform is based on
StructureTrusses. What links them is struct_num.
 

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