473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to make the tab control to open on a specific page?

176 100+
When I open form2 I would like the tab control to be opened on a specific tab page, depending on the preferences of form1.

Is it possible to do?
Cheers.
Dec 25 '06 #1
2 3159
missinglinq
3,532 Expert 2GB
Almost anything is possible! Here's some sample code, where the form to be opened is 2ndForm and the tabbed page to be displayed on open of 2ndForm is named ThirdPage. The final argument of the OpenForm command is called openargs, and you assign a value to it in the calling form, then check for its value in the FormLoad event of the called form
and do something (open a tabbed page isn this case) accordingly.

Expand|Select|Wrap|Line Numbers
  1. 'On the first form 
  2. Private Sub GotoTabbedPage_Click()
  3. Dim strPageToOpen as String    
  4.    strPageToOpen = "ThirdPage" 
  5.    DoCmd.OpenForm "2ndForm", , , , , , strPageToOpen
  6. End Sub
  7.  
  8. 'On the second form
  9. Private Sub Form_Load()
  10.     If OpenArgs = "ThirdPage" Then
  11.       ThirdPage.SetFocus
  12.     End If
  13. End Sub
In your code in the first form you need to set the variable strPageToOpen equal to the preference from your first form, however you determine that, then in the second form, include in the If...End If construct all possible choices for pages to open. If you have many of these you might want to replace the If...End If construct with Select Case.
Dec 25 '06 #2
ADezii
8,834 Expert 8TB
When I open form2 I would like the tab control to be opened on a specific tab page, depending on the preferences of form1.

Is it possible to do?
Cheers.
'Another option would be to use the Value Property of the Tabbed Dialog
'Control. In the Open() Event of the 2nd Form:

Expand|Select|Wrap|Line Numbers
  1. Select Case Me.Openargs
  2.     Case "FirstPage"
  3.         Me!TabCtl62.Value = 0
  4.     Case "SecondPage"
  5.         Me!TabCtl62.Value = 1
  6.     Case "ThirdPage"
  7.         Me!TabCtl62.Value = 2
  8.     Case "You get the idea"
  9. End Select
NOTE: Individual Pages are indexed starting at 0, thus the offset
Dec 26 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ck388 | last post by:
I am trying to open a frameset in a new window......where the frame called "main" shows the file called customerGeneral.aspx. I can't get it to work though...i always get something like...
7
by: TDIOwa | last post by:
I have a form that has a specific date on it. I want to open another form that has the Active Control Calendar on it. I want to open this form to the specific date on the first form. I have...
4
by: Rick Csucsai | last post by:
After a year and a half of not touching ASP.NET, I have finally talked my company into letting me build a useable app in .NET instead of classic. Now I have to play catch up. i would really...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
2
by: jerry.ranch | last post by:
I'm starting to learn about the tab control. How would I write an on open event procedure in VBA, that upon opening of the form, a specific tab opens (say tab 1)? Thanks Jerry
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
11
by: -D- | last post by:
How can I turn the visibility of the xml control on or off? <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNavBar.ascx.cs" Inherits="compass.user_controls.TopNavBar"...
6
by: Ian Boyd | last post by:
Every time during development we had to make table changes, we use Control Center. Most of the time, Control Center fails. If you try to "undo all", it doesn't, and you end up losing your identity...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.