Link to home
Start Free TrialLog in
Avatar of João serras-pereira
João serras-pereiraFlag 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.

User generated image

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?
Avatar of PatHartman
PatHartman
Flag of United States of America image

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

sfrmEndorsementList.Form!EndorsementID

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

ASKER

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 ?
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.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Thanks!
I (thought I) had it that way. But started all over again and now it works!!!