Subform to show same record as Controling Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want my subform ( made from an existing form) to show the same record as my
control form record. Eg. I'm on record 13 of control form and open (on
click) my subform- the subform shows the 1st record and not the 13th. I want
sub to open on the 13th record also.

Thanks.
 
Presumably you are just using the subform to find the record, and then you
can see the details and edit it in the main form?

That's kinda backwards to the way Access works, so can I suggest an
alternative. It involves a list box on an unbound main form for navigation,
and then you edit the selected record in the subform. This is simple, avoids
concurrency errors, avoids the bugs associated with entering a new record in
the subform, requires no code, and works faster.

1. Presumably you already have the main form set up as you wish for editing.
Delete the subform. Save. Close.

2. Create a new form, not bound to any table.

3. Add a list box to the left of this form.
Set its RowSource so it shows the columns you want, sorted correctly.
Include the primary key field first.
Use the Column Widths property so this field is zero-width if you do not
want to see it.

4. Drag your editing form from the database window onto this form, beside
the list box. Access shows it as a subform control.

5. Right-click the edge of the subform control, and choose Properties.
Set the Link Master Fields property to the name of your listbox.
Set the Link Child Fields property to the name of the primary key.

Now you can select any row in the list box, and the subform shows the record
for editing.
 
Back
Top