Re: Accessing data from a subform in the parent form's recordset

Tech-Archive recommends: Fix windows errors by optimizing your registry



Pat,
with a form subform setup, put the record ID on the parent form in a textbox
control.
Also put the recordID which is the foreign key on the child subform on the
subform in a textbox control.
The link master fields will be firearm_id and the link child fields will be
weaponid.
That is assuming that there is a one to many relationship between firearms
table and the weapons table and the tables are joined on that field.
This means in the relationship window, that you click on the firearm_id and
drag and drop it on the weaponid in the weapons table.
Setting up the link master fields and link child fields lets access manage
all the work to save the main form record before you add new child records.

Jeanette Cunningham

"Pat" <Pat@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D06B6844-AC3E-4F3F-9837-D005F7E2FD26@xxxxxxxxxxxxxxxx
I have a field in the main DB that is the record ID (autonumber) which is
not
displayed on the parent form. But because I have a table relationship
setup
with the child table I need to access this field from child form when
inserting records into the child DB. It works if the record is existing
and
being edited, but on a insert into the main table it will not be visable
to
the child.

I am opening the parent form in Add Mode with the following syntax:
DoCmd.OpenForm "frm_ModifyFirearms", acNormal, , , acFormAdd, acDialog

The field in the main db is firearm_id. The field in the child DB is
weaponid. The subform does have the fileds linked on the parent form.

I hope I made some since of this question. I am new to Access and VBA.

Thanks in advance....


.



Relevant Pages

  • Re: Accessing data from a subform in the parent forms recordset
    ... THis commits the record before the subform ... The link master fields will be firearm_id and the link child fields will ... drag and drop it on the weaponid in the weapons table. ...
    (microsoft.public.access.formscoding)
  • Re: One to Many Form Design Issue
    ... I then returned to the parent form, went into design mode, and added the child table form as a SubForm. ...
    (microsoft.public.access.forms)
  • Re: Accessing data from a subform in the parent forms recordset
    ... THis commits the record before the subform fires ... The link master fields will be firearm_id and the link child fields will be ... drag and drop it on the weaponid in the weapons table. ...
    (microsoft.public.access.formscoding)
  • Re: Accessing data from a subform in the parent forms recordset
    ... subform attempts to update the child DB. ... Also put the recordID which is the foreign key on the child subform on the ... The link master fields will be firearm_id and the link child fields will be ... drag and drop it on the weaponid in the weapons table. ...
    (microsoft.public.access.formscoding)
  • Re: Option to save or undo
    ... form and has a subform within. ... the fields that are linked on the parent form to the child ... As George indicated *Something* is changing data if records are being saved. ...
    (microsoft.public.access.formscoding)