[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

open up the form with correct tab

Posted on 1998-06-24
2
Medium Priority
?
155 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 40 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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