Re: tabbed subform related new record.



Chris wrote:
I have subforms on tabs and since linked by common id (InvNum) they display
and edit fine. I can add a new record to the first tab (jobs) successfully.
I am at a loss as to how to create the related records on adjacent tab for
(labor). All relate to InvNum (key field in each) and are in their own
tables. Job table is related one-to-one to labor, RI enforced, cascade
update/delete is true.

My subforms are DataEntry and Additions = No, so I set to Yes after setting
focus to the subform on the adjacent tab.

Code:
Me![BCfrm].SetFocus
Me![BCfrm].Form.DataEntry = True
Me![BCfrm].Form.AllowAdditions = True
RunCommand acCmdRecordsGoToNew
Me![BCfrm].Form!InvNum = Me![Jobfrm].Form!InvNum
Me![BCfrm].Form!txtholdFocus.SetFocus
DoCmd.Save


Well, I think you've lost me me. However there are a couple
of things that might help you.

1) DoCmd.Save save the active object's design. The active
object is normally the running form, so that line makes no
sense in this context. I'm pretty sure that you are trying
to save the new labor record, which can be done using:
Me![BCfrm].Form!Dirty = False

2) You can synchronize two subforms by adding a text box
(named txtLink) to the main form's header/footer section.
In the Jobs subform's Current event, set the text box to the
JobID field:
Parent.txtLink = Me.JobID
Then setting the labor subform control's Link Master
property to InvNum,txtLink and set Link Child to
InvNum,JobID

The latter point may not be relevant in your case, since you
said the tables are all related one-to-one, which seems more
than a little odd to me. Normally, I would expect an
invoice to related one-to-many to jobs and jobs one-to-many
to labor.

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: tabbed subform related new record.
    ... The two subforms are on the same tab control,different tabs. ... Jobs - one BCfrm and one Laborfrm each ... Job table is related one-to-one to labor, RI enforced, cascade ...
    (microsoft.public.access.formscoding)
  • Re: tab control link
    ... Any object on a tab page is still considered to be on the Main form. ... If your Job and Labor subs work now, they will still work when LaborSub ... Personally, I would try my best to place both subforms on the same tab, so... ... Form2 is on TabControl and is a subform of Form1. ...
    (microsoft.public.access.forms)
  • Re: Interesting
    ... what kinds of jobs can be outsourced. ... How do you define the wealth of a nation? ... playing field for labor, NOW while we still can use our markets as ... degree of job-security risk private industry workers face. ...
    (soc.retirement)
  • Re: Interesting
    ... what kinds of jobs can be outsourced. ... Measurement of standard of living is generally in terms of "basket of ... playing field for labor, NOW while we still can use our markets as ... degree of job-security risk private industry workers face. ...
    (soc.retirement)
  • Re: Interesting
    ... what kinds of jobs can be outsourced. ... it just seems to me those who think that the boogie man is outsourcing, ... playing field for labor, NOW while we still can use our markets as ... degree of job-security risk private industry workers face. ...
    (soc.retirement)