Tabbed control and populating multiple subforms


T

tbrogdon

I have a main form (frmAddProd) which contains a tabbed control with 2
pages. Each page contains a subform bound to the main form on fields:
ProductionDate, Dept, and Shift. The subforms (sfmProdOp and
sfmEmpProd) are not directly related to each other though. sfmProdOp
is on page 0. sfmProdOp is in datasheet view.

So the user enters data on the main form into ProductionDate, Dept,
and Shift and hits the <enter> key which moves the cursor to the first
field in sfmProdOp for more data entry.

My problem: if at this point I select the 2nd tabbed page (page 1)
which contains sfmEmpProd the fields ProductionDate, Dept, and Shift
are not populated on that page even though those fields are directly
linked to the main form - and they do populate the appropriate fields
on the other subform (page 0)

Why is this and how can I achieve this?

Thanks,

Tim
 
Ad

Advertisements

D

Damon Heron

do a requery of the subform.
like this:
Forms!frmAddProd.sfmEmpProd.Requery

Damon
 
D

Damon Heron

Put it in the After Update event of the main form that you changed.

Damon

do a requery of the subform.
like this:
Forms!frmAddProd.sfmEmpProd.Requery

Do I do this on the OnLoad event?

Tim
 
T

tbrogdon

Put it in the After Update event of the main form that you changed.

Damon

Hi Damon,

I tried the code in the AfterUpdate event of the main form and
received the following error message:

"Runtime error: 2465. Application-defined or object-defined error."

So I removed that code and put the same code in the AfterUpdate event
of the subform. It doesn't seem to work there either.

What does happen is that when I go to the subform on page(1), the
records are entirely unpopulated. I can ente an employee's name in
field EmployeeID and at that point the data from the 3 fields in the
main form populates the record I am working on in the subform on
page(1). What I want to happen is that when page(1) is accessed the
first record already has the 3 fields that correspond to the 3 fields
in the main form to already be populated.

I guess it IS accomplishing this but I, since I am new to this, I am
assuming that those 3 fields should already be filled when that page
is accessed instead of after beginning a new record.

Oh, I always overthink this stuff...................................
<grin>

Thanks,

Tim
 
M

Marshall Barton

I have a main form (frmAddProd) which contains a tabbed control with 2
pages. Each page contains a subform bound to the main form on fields:
ProductionDate, Dept, and Shift. The subforms (sfmProdOp and
sfmEmpProd) are not directly related to each other though. sfmProdOp
is on page 0. sfmProdOp is in datasheet view.

So the user enters data on the main form into ProductionDate, Dept,
and Shift and hits the <enter> key which moves the cursor to the first
field in sfmProdOp for more data entry.

My problem: if at this point I select the 2nd tabbed page (page 1)
which contains sfmEmpProd the fields ProductionDate, Dept, and Shift
are not populated on that page even though those fields are directly
linked to the main form - and they do populate the appropriate fields
on the other subform (page 0)


Normally, the link child fields' text boxes are invisible
because they have the same values as the link master fields,
that, normally are already displayed on the main form.

Regardless of their visiblity, the linking fields are
automatically supplied to the subform fields when the new
record becomes dirty (i.e. the first keystroke in any bound
control). This is the standard behavior for the
DefaultValue property and autonumber fields too.

My advice, if you insist on displaying the linking fields,
is to live with things the way they are.
 
Ad

Advertisements

Ad

Advertisements

D

Damon Heron

The error msg you received suggests that access can't find the subform or it
isn't open yet. Just for debugging purposes, try putting a command button
on the page that has the subform on it.
On the click event of the command button, enter
Forms!frmAddProd.sfmEmpProd.Requery
and see what happens. Of course, first enter data on the main form, so the
subform can have something to requery.

Damon

Put it in the After Update event of the main form that you changed.

Damon

Hi Damon,

I tried the code in the AfterUpdate event of the main form and
received the following error message:

"Runtime error: 2465. Application-defined or object-defined error."

So I removed that code and put the same code in the AfterUpdate event
of the subform. It doesn't seem to work there either.

What does happen is that when I go to the subform on page(1), the
records are entirely unpopulated. I can ente an employee's name in
field EmployeeID and at that point the data from the 3 fields in the
main form populates the record I am working on in the subform on
page(1). What I want to happen is that when page(1) is accessed the
first record already has the 3 fields that correspond to the 3 fields
in the main form to already be populated.

I guess it IS accomplishing this but I, since I am new to this, I am
assuming that those 3 fields should already be filled when that page
is accessed instead of after beginning a new record.

Oh, I always overthink this stuff...................................
<grin>

Thanks,

Tim
 

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