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.

Screen-Shot-2018-03-14-at-17.07.38.png

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?
João serras-pereiraAsked:
Who is Participating?
 
Jim Dettman (Microsoft MVP/ EE MVE)Connect With a Mentor President / OwnerCommented:
1. Put a hidden control on the main form.

2. For the control that holds sf2, set the master link to the name of the hidden control.

3. In sf1's OnCurrent event, put the value of the key into the hidden control on the main form:

   Me.Parent.<control> =

Now when sf1 changes, the OnCurrent will fire, the value will be placed in the hidden control, and sf2 will change based on that.

Jim.
0
 
PatHartmanCommented:
On a similar form I built, the Master link looks like:

sfrmEndorsementList.Form!EndorsementID

so it is subformname.Form!PKname
0
 
João serras-pereiraAuthor Commented:
Hi
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  
      Forms!F110_ConvencoesFinanciamentoMaster!F110_NumeroProjetoCorrente
is the key in the master form, whichs correct
 shall i do:

subformname.Form!PKname =  Forms!F110_ConvencoesFinanciamentoMaster!F110_NumeroProjetoCorrente ?
0
 
PatHartmanCommented:
You don't need ANY code or at most, you might need to requery the subform from the list form's Current Event

Me.Parent.othersubform.Requery

This is what the master/child link is designed to do - sync the child form to the current record of the master form.
0
 
João serras-pereiraAuthor Commented:
Hi Thanks!
I (thought I) had it that way. But started all over again and now it works!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.