Solved

open up the form with correct tab

Posted on 1998-06-24
2
149 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now