Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ms/acceee link a subform to a control

Posted on 2016-11-12
9
Medium Priority
?
56 Views
Last Modified: 2016-11-13
Hi.
I am developing a form that contains 2 subforms. The first subform contains a  list of records that, when a make a specific record "current", by clicking on it, I want to see all details on the right subform that is a single form, not a list.
the master form for both, contains a control that is updated every time I make a new record current on the list form and it works perfectly.

However, this masterform control is "unbound" to a Table/Query as I just want to select a specific record to show the detail, and do not want to change the content of the record itself.

is there a manner to link a subform field to this control?
alternatively:
if I bind the control to the table/query, is there a manner to make the "current" record in the list subform, a current record on the master form, so the master/child relation can work for the other form?

thanks in advance
(I am embedding a screenshot of the form where you may see the master form with a now visible and correct key, and both e list subform (on the left) and the single subform (on the right)

thanks in advance




screenshot
0
Comment
Question by:João serras-pereira
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 22

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 2000 total points
ID: 41884600
you can use a reference to the control in subform1 for the LinkMasterFields of subform2:
     subform_controlname1.form.controlname

Open in new window

Alternately, you can use the unbound control you are updating.

On the current event of subform1:
     me.parent.subform_controlname2.requery 

Open in new window

0
 

Author Comment

by:João serras-pereira
ID: 41884663
Hi
now I am scratching my head...

the unbound control name is [fld_codigoTicket] but I can't figure ou a manner to link this to the subform... In the menu is just allows me to link IF the field is bound...

please check the screenshots

ss1
ss1
ss3
0
 
LVL 22

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 2000 total points
ID: 41884670
type the control name you want in LinkMasterFields without using the menu

LinkMasterFields can be an unbound control.  It can also, as I showed above, reference the control on the first subform.  Just type what you want ;)

You must, however, requery subform2 in the Current event of subform1 so it changes right away
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 51

Expert Comment

by:Gustav Brock
ID: 41884676
This is automatic.

On the main form:
Form unbound.
fld_codigoTicket is unbound (as now)

On the left subform:
Have this code in the OnCurrent event:

    Me.Parent!fld_codigoTicket.Value = Me!codigoTicket.Value

Set Master/Child link fields to left subform:
Empty.

Set Master/Child link fields to right subform:

    MasterLink: fld_codigoTicket
    ChildLink: codigoTicket

/gustav
0
 

Author Closing Comment

by:João serras-pereira
ID: 41884680
a big THANKS!!!!!
0
 
LVL 22
ID: 41884681
you're welcome ~ happy to help
0
 
LVL 22
ID: 41885388
after looking up one of my past projects, I see that all I did was use an unbound textbox on the mainform for LinkMasterFields of the second subform with this equation:
    =nz(subform_controlname1.form.controlname)

Open in new window

No requery is needed in code behind the first subform -- Access does everything automatically

Unlike LinkChildFields, which must be a field(s) in the RecordSource and better to be in a control(s) on the subform (Visible can be No), LinkMasterFields can be an unbound control(s).
0
 

Author Comment

by:João serras-pereira
ID: 41885408
thanks!!
0
 
LVL 22
ID: 41885423
you're welcome ~
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question