Two Subforms - Same Record

S

Steve

I have a form, primary subform and secondary subform. A tab control takes up all
the area of the primary subform. There are about 15 tabs on the tabcontrol. Each
tab contains fields from the same table. Related fields appear on each tab.
There is one field in the table that needs to be displayed at all times so I
created the secondary subform (subform to main form) to display just that one
field. Data entry is main form - secondary subform - main subform. When enter a
new record, data is first entered in the main form. Next a value is entered in
the secondary subform. Finally data entry is completed in the primary subform. A
problem occurs here. The primary subform goes to a new record rather than
staying on the same record as the secondary subform. How can I get the primary
subform to stay on the same record as the secondary record so the data entered
in the primary subform is recorded in the same record as the data that was
entered in the secondary subform.

Thanks for all help!

Steve
 
J

John Vinson

I have a form, primary subform and secondary subform. A tab control takes up all
the area of the primary subform. There are about 15 tabs on the tabcontrol. Each
tab contains fields from the same table. Related fields appear on each tab.

WHOA. How many fields in your table!? FIFTEEN tab controls - you must
be pushing the 255 field limit, and (much more insidiously) the 2000
characters per record limit. Are you certain that your table is
properly normalized?
There is one field in the table that needs to be displayed at all times so I
created the secondary subform (subform to main form) to display just that one

It is not necessary to have a separate subform to do this, and I'd in
fact advise against it. It's perfectly possible to put this one field
on the Form *NOT* on the tab control; or, if you prefer, you can put
fifteen controls all bound to the same field, one on each tab page.
Having the same record open simultaneously on two subforms can and
will (as you have seen) get you into synchronization trouble!
 
S

Steve

John,

Thanks for responding! You misread my post, there's not 15 tab controls; there's
only one with 15 tabs. The table has around 60 fields so each page of the tab
control only has a couple of fields. The design of the tab control takes up all
the area of the primary subform so there's no room to put the one field outside
the tab control.

I am going to look at implementing your suggestion of fifteen controls all bound
to the same field, one on each tab page. Is there any way to put a textbox on
the main form but bind it to a field in the recordsource of the subform? Maybe
something like Forms!MyMainForm!MySubformControl!MyField in the control source
property???

In the way of synchronized subforms, is there a way to make two subforms based
on the same record source always be on the same record, ie, data entry in either
subform will always record data in the same underlying record?

Thanks, John,

Steve
 
T

tina

Is there any way to put a textbox on
the main form but bind it to a field in the recordsource of the subform? Maybe
something like Forms!MyMainForm!MySubformControl!MyField in the control source
property???

the above field reference will probably work, except you may have to modify
it to
Forms!MyMainForm!MySubformControl.Form!MyField
fyi, if you go the "control on subform" route, you shouldn't need a separate
control for each page. in design view, drag the side of the form out away
from the edge of the tab control (this is temporary, just to give you room
to work). add a text box control in that newly opened space in the detail
section. now drag the text box over on to the tab control *without selecting
either the tab control or any specific page*. click thru your tabs and you
should see the new text box showing "thru" on every one. drag the right side
of your form back to its' original position.

hth


Steve said:
John,

Thanks for responding! You misread my post, there's not 15 tab controls; there's
only one with 15 tabs. The table has around 60 fields so each page of the tab
control only has a couple of fields. The design of the tab control takes up all
the area of the primary subform so there's no room to put the one field outside
the tab control.

I am going to look at implementing your suggestion of fifteen controls all bound
to the same field, one on each tab page. Is there any way to put a textbox on
the main form but bind it to a field in the recordsource of the subform? Maybe
something like Forms!MyMainForm!MySubformControl!MyField in the control source
property???

In the way of synchronized subforms, is there a way to make two subforms based
on the same record source always be on the same record, ie, data entry in either
subform will always record data in the same underlying record?

Thanks, John,

Steve


takes up
all tabcontrol.
Each tab.

WHOA. How many fields in your table!? FIFTEEN tab controls - you must
be pushing the 255 field limit, and (much more insidiously) the 2000
characters per record limit. Are you certain that your table is
properly normalized?
that one

It is not necessary to have a separate subform to do this, and I'd in
fact advise against it. It's perfectly possible to put this one field
on the Form *NOT* on the tab control; or, if you prefer, you can put
fifteen controls all bound to the same field, one on each tab page.
Having the same record open simultaneously on two subforms can and
will (as you have seen) get you into synchronization trouble!
 
S

Steve

Tina,

Thanks for responding!

That's a great idea for the textbox!!

I haven't been able to get the field reference to work!

Steve
 
D

dandgard

If you had designed your tab control correctly you could have the on
field that needs to be on all tabs show up on all tabs and then desig
the other fields around the placement of that field. Try this, creat
a field and then drag and drop it onto the tab control. It will sho
up on top for all tab indices. IF you place it properly I am sure yo
can work the other fields on each individual tab around it.

You should not have two subforms to the same form that open the sam
record
 
J

John Vinson

drag the text box over on to the tab control *without selecting
either the tab control or any specific page*. click thru your tabs and you
should see the new text box showing "thru" on every one.

great idea Tina! Turning what is often seen as a "bug", or at least an
undesirable feature, to good use!
 
T

tina

thank you, John! <humble bow and big smile>
i've often added command buttons that way, such as Close, Quit, maybe
Reports - anything I want to be seen (and have the same use) on more than
one tab. if there are certain tabs I don't want the control seen on, i
hide/show it in the tab control's OnChange event with a Select Case
statement.
i guess once in a great, great while it pays to not know something is a bug!
<g>
 

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