Wrox Programmer Forums
|
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
 
Old March 6th, 2006, 08:10 PM
Registered User
 
Join Date: Dec 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Giving focus back to form

Hello.

Within a form I've opened a subform. Based upon a click event on this subform I would like to replace this current subform with a new subform. Without using a tab object how might I go about going from 1 subform to another subform? I also don't want to have a subform within a subform.

Form
 |--> Subform 1
 |--> Subform 2


Thank you.

 
Old March 7th, 2006, 03:24 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try the following:

Assume
Main form ==> FrmMain
Subform container in FrmMain ==> subFrmContainer
Sub forms are: subFrm1 and subFrm2
(They are loaded into the subFrmContainer of FrmMain)

================================================== ===============
Inside subFrm1, include a command button "cmdChangeSubForm"
Code for cmdChangeSubForm_Click:

Private Sub cmdChangeSubForm_Click()

'Change frmMain!subFrmContainer.sourceobject to the new sub form
    Me.Parent!subFrmContainer.SourceObject = "subFrm2"

End Sub

================================================== ===============

Hope I am not confusing you.


Scripts82





Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Focus on a Sub Form Brendan Bartley Access 5 September 9th, 2005 10:49 AM
Setting Focus on a Sub Form Brendan Bartley Access 1 August 8th, 2005 02:41 AM
how to focus a form in my case. arif_1947 VS.NET 2002/2003 1 November 3rd, 2004 01:49 PM
Giving focus to controls KevinO ASP.NET 1.0 and 1.1 Basics 3 January 16th, 2004 02:52 PM
refresh results on focus form lfotopoulos VB Databases Basics 1 November 28th, 2003 04:13 AM





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