link subforms

G

Guest

Hi all

Since you can't put a subform on a continuous form I have got round the
problem by creating a blank form (frm Staff) and putting two subforms on it.
The sub forms are linked via the master and child fields. This works on the
first record of subform1 (ecs staff) but when I move to record two I want the
subform2 (holiday entitlement) to refresh and show related records. I tried a
requery command but I get an error (see below). Please can someone point me
in the right direction, thanks!

Sue

On Current event (of ecs staff)
Forms![frm staff].Forms![Holiday Entitlement].Requery

Error 2465: Application defined or object defined error.
 
J

Joan Wild

Here's an easier way to get it to work. Put a textbox on the main form and
set its control source to the primary key of the first subform
=[ecs staff].[Form]![StaffID]
Give it a name of txtLink
Substitute the name of the subform1 control for ecs staff and the name of
the primary key.

In the link master/child properties of the second subform, set the Master to
txtLink and the child to the appropriate field (equivalent of StaffID in
above)
 
G

Guest

Thanks Joan that sorted it :)


Joan Wild said:
Here's an easier way to get it to work. Put a textbox on the main form and
set its control source to the primary key of the first subform
=[ecs staff].[Form]![StaffID]
Give it a name of txtLink
Substitute the name of the subform1 control for ecs staff and the name of
the primary key.

In the link master/child properties of the second subform, set the Master to
txtLink and the child to the appropriate field (equivalent of StaffID in
above)


--
Joan Wild
Microsoft Access MVP
Hi all

Since you can't put a subform on a continuous form I have got round
the problem by creating a blank form (frm Staff) and putting two
subforms on it. The sub forms are linked via the master and child
fields. This works on the first record of subform1 (ecs staff) but
when I move to record two I want the subform2 (holiday entitlement)
to refresh and show related records. I tried a requery command but I
get an error (see below). Please can someone point me in the right
direction, thanks!

Sue

On Current event (of ecs staff)
Forms![frm staff].Forms![Holiday Entitlement].Requery

Error 2465: Application defined or object defined error.
 

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