Solved

open up the form with correct tab

Posted on 1998-06-24
2
152 Views
Last Modified: 2010-05-03
hi,
Here is my problem:
in form1
Private Sub form_load(0
     sstab.tab = 0
end sub

in form2
Private Sub cmd1_click()
     load form1
end sub

Now when I click cmd1, it will load form1, but with tab 0. where should I code to open the form with tab1 without changing the line sstab.tab = 0?

sstab.tab = 0 in form_load can't be changed because in most cases, the form will be opened with tab 0. And in some other cases, It need to be opened with tab 1. That is my real question..

thank you

:)
ny971181
0
Comment
Question by:ny971181
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 20 total points
ID: 1464202
Create a public property on the form:

In the declarations section:
Public OpenTab As Integer

Add the following code to your Form Load event:

Private Sub Form_Load()
  ssTab.Tab = Me.OpenTab
  Me.OpenTab = 0  'Resets OpenTab for the next time
End Sub

Then when you open the form, set the tab you need to open (if you don't specify a tab, tab0 will be set)

Form1.OpenTab = 1
Form1.Show '(will open with Tab1)

or

Form1.Show '(will open with Tab0)
0
 
LVL 1

Expert Comment

by:dgb001
ID: 1464203
You could just create a global variable (ie. declare it in a .bas module as somthing like OPENTAB) and then just set it as required. On form load then just :

Private Sub Form_Load()
  ssTab.Tab = OPENTAB  'which would be set on cmd_click to 1
  OPENTAB = 0          'reset to default
End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question