Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Vars between reports 1

Status
Not open for further replies.
Oct 1, 2003
53
US
OK i have these 2 forms one leads to the other.

the only problem is form number 2 needs some info from form number one.

this is the code from form 2 where it expects info from form 1

=[Forms]![frmLeadProjectInfoAdd]![ProjectID]

form2 is named frmLeadcontactadd
form1 is named frmLeadProjectInfoAdd

I don't know how to relay this info to form number 1 from form number 2.

please help they are mean to me here...
 
the code from form 1 that launches form 2 is:

DoCmd.OpenForm "frmLeadcontactadd", , , , acFormAdd
 
One way to pass data through the OpenForm command is by using the OpenArgs parameter.

From form1, try the following code:
Code:
Dim lStr_ProjectID

lStr_ProjectID = Trim(Me.ProjectID)
DoCmd.OpenForm "frmLeadcontactadd", acNormal, , , acFormAdd, acDialog, lStr_ProjectID
Of course you may want to use different values for some of the parameters, but the last parameter is the data that you are passing.
Then in the Form_Load event of form2, try the following code:
Code:
Private Sub Form_Load()
   Dim lStr_ProjectID as String  
   lStr_ProjectID = Me.OpenArgs
End Sub

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top