By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Pass value from 1 form to another

P: 2
I have 2 access forms,
In 1st form I am displaying reportname from my table
then I will select one record from 1st form and will press next button
now I want to display this reportname onto next 2nd form in a text box
but its not working

my code
Expand|Select|Wrap|Line Numbers
  1. Private Sub EditReport_CB_Click()
  2. On Error GoTo Err_EditReport_CB_Click
  3. Dim DB As Database
  4. Dim Rnv1 As String
  5. Dim strSQL As String
  6. Dim frm1 As New Form_F_reportWizard1
  7. Dim frm21 As New Form_F_reportWizard21 
  9. Rnv1 = Me.REPORT_NAME_CB.Value 
  11. frm21.SetFocus
  12. frm21.ReportName_TB.SetFocus
  13. frm21.ReportName_TB.Text = Rnv1 'here it shows the correct reportname  
  15. Dim stDocName1 As String
  17. stDocName1 = "F_ReportWizard1"
  18. DoCmd.Close acForm, stDocName1
  21. Exit_EditReport_CB_Click:
  22. Exit Sub 'but after this line form 2 closed and no values are available.please help!!!
  23. Err_EditReport_CB_Click:
  24. MsgBox Err.Description
  25. Resume Exit_EditReport_CB_Click
  26. End Sub
Sep 21 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,492
Check out Referring to Items on a Sub-Form. It includes how to reference forms from anywhere really. You can refer to form1 from form2 if you need to.
Sep 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.