Re: tabbed subform related new record.
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Fri, 31 Aug 2007 11:10:47 -0500
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]
.
- Follow-Ups:
- Re: tabbed subform related new record.
- From: Chris
- Re: tabbed subform related new record.
- Prev by Date: Re: Hide column in contious form
- Next by Date: On Open, Set a field to locked.
- Previous by thread: How to reference an attached mdb?
- Next by thread: Re: tabbed subform related new record.
- Index(es):
Relevant Pages
|