Solved

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

Posted on 2014-04-08
7
551 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

749 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