Solved

Grab the first field of selected Row in subform and Display it

Posted on 2014-04-08
7
570 Views
Last Modified: 2014-04-08
Hello All,

I have a simple form and within that form there is a sub form. I want to set up an main form (On Open)  event so that when the main form opens up, it can get the value of  filed1 of the selected row  of sub form value and display it…can anybody help. I got confused with many examples in the internet with very long codes.  Please assist.

Thank you
0
Comment
Question by:Rayne
[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
  • 4
  • 3
7 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39987790
Is the main form a 3rd form? and will the row be selected beforehand?
It may be easier to have a global variable and populate it when the row is selected.
e.g.
on subform click event
 gVar = vvv

and on main form load
 fieldX = gvar
0
 

Author Comment

by:Rayne
ID: 39987796
Hello COACHMAN99

Is the main form a 3rd form? and will the row be selected beforehand? - probably, I guess. Like when you open a main form, the very first row of the sub form is selected by default, isn't it?
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39987812
Private Sub Form_Click()
Forms("frmMain").Text3 = vvv
End Sub
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:Rayne
ID: 39987814
Is using a global variable is a good approach?
0
 
LVL 7

Accepted Solution

by:
COACHMAN99 earned 500 total points
ID: 39987815
if you are working with a main and sub form then place the following code in the sub form (click event) - no global variable. (vvv = your field)

Private Sub Form_Click()
Forms("frmMain").Text3 = vvv
End Sub
0
 

Author Comment

by:Rayne
ID: 39987824
Perfection to THE Ultimate,

Thank you Sire, your saved my drowning boat, thank you thank you :)
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39987827
glad I could help :-)
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

632 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