p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Opening forms from other forms (http://p2p.wrox.com/showthread.php?t=19216)

Paulsh September 30th, 2004 02:17 PM

Opening forms from other forms
 
When in Access, is it possible after opening a form, for a control on that form (click) to open a second form?

Thanks
Paul


jmaronilla September 30th, 2004 06:54 PM

Paul,
Yes, I have done it in most of my forms.
How it works is, you need to have a index field value to
reference the second form record to open.
Code example:

Private Sub Open_Form_Name_Click()
On Error GoTo Err_Open_Form_Name_Click

  Dim strfrm As String
  Dim strWhere As String

  strfrm = "Form - " & [Form_Name]
  strWhere = "ID = " & Me!ID
  DoCmd.OpenForm FormName:=strfrm, WhereCondition:=strWhere

Exit_Open_Form_Name_Click:
  Exit Sub

Err_Open_Form_Name_Click:
  Resume Exit_Open_Form_Name_Click

End Sub

Hope this helps.
John


All times are GMT -4. The time now is 06:45 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.