Avatar of João serras-pereira
João serras-pereira
Flag for Portugal asked on

link subform to a dummey field in the master form

Hi -
On my app I need to show a list of records and, upon a record is selected, thus becoming the "current" record of the form I need to display the entire details.
The below screenshot demonstrates the sought output.


In order to implement this, I have a master form "mform" and 2 subforms, "sf1", with the list of records, so it is of type "continuous forms" and "sf2" containing the detailed info, of type "single form". "As such "mform" is unbound: the records are shown in SFI and their detail in SF2 - SF2 is bound t the master table from which SF1 records are displayed

My problem is that whenever a new current record in SF1 is selected, I should have a means of modifying the  contents of  SF2.

I have tried to link SF2 to a dummy field in MFORM containing the  actual record key, but I am getting an error as ms/access thinks that the field name is a Parameter. Of course  also I cannot bound the dummy field to the master table and bound MFORM to it - ms/access yields an error as it thinks that I am trying to modify the record key

what shall I do?
 can anyone help?
Microsoft AccessVBA

Avatar of undefined
Last Comment
João serras-pereira

8/22/2022 - Mon

On a similar form I built, the Master link looks like:


so it is subformname.Form!PKname
João serras-pereira

Could you elaborate just a bit?
I m scratching my head.

In the "current" on sf1 subform I have

Private Sub Form_Current()

    Me.F113_NumeroProjetoCorrente = Me.F113_NumeroProjeto
    Forms!F110_ConvencoesFinanciamentoMaster!F110_NumeroProjetoCorrente = Me.F113_NumeroProjeto
    If CurrentProject.AllForms("F91_LoggedUser").IsLoaded Then
        Forms!F91_LoggedUser!F91_NumeroProjetoCorrente = Me.F113_NumeroProjeto
    End If

End Sub

Open in new window

The field  
is the key in the master form, whichs correct
 shall i do:

subformname.Form!PKname =  Forms!F110_ConvencoesFinanciamentoMaster!F110_NumeroProjetoCorrente ?

You don't need ANY code or at most, you might need to requery the subform from the list form's Current Event


This is what the master/child link is designed to do - sync the child form to the current record of the master form.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Jim Dettman (EE MVE)

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
João serras-pereira

Hi Thanks!
I (thought I) had it that way. But started all over again and now it works!!!