Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 30th, 2004, 02:17 PM
Authorized User
 
Join Date: Sep 2004
Location: Twickenham, , United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Paulsh Send a message via Yahoo to Paulsh
Default 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

__________________
Paul
  #2 (permalink)  
Old September 30th, 2004, 06:54 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: South San Francisco, CA, USA.
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening 1 form from 2 forms rocknrisk Access 5 July 29th, 2005 06:05 PM
Help with opening and closing forms Dwizz VB.NET 2002/2003 Basics 4 April 21st, 2005 03:19 AM
opening and closing forms mp VB.NET 2002/2003 Basics 6 April 2nd, 2005 07:37 PM
how can I speed up the opening of forms? Mihai B Access VBA 6 March 14th, 2005 06:05 AM
Closing and Opening Forms Louisa VB.NET 2002/2003 Basics 1 February 5th, 2004 02:40 PM





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