Solved

open up the form with correct tab

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now