Solved

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

Posted on 2014-04-08
7
540 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IT Desktop Support 11 68
Create a EXCEL FIle from Access Procedure 1 14
Dcount using a date in a table compared to today's date 3 30
Create report using crosstab query 11 29
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…

776 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