Solved

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

Posted on 2014-04-08
7
522 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now