Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2008

Tip: Looking for answers? Try searching our database.

Open the form with 2nd tab focused instead of 1st tab

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Song Su - 31 Jan 2008 22:23 GMT
Access 2003

I have a button on a form to open another form with 2 tabs.

What's the code to open a form with 2nd tab focused instead of default 1st
tab?
Linq Adams - 31 Jan 2008 22:46 GMT
Try this: In the Form_Load event of the second form, set focus to a control
that resides on the second tabbed page. If the control is named YourControl,
use  

Private Sub Form_Load()
 YourControl.SetFocus
End Sub

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Song Su - 31 Jan 2008 22:59 GMT
Thanks for quick reply. Let me make more clear:

My form1 as 2 buttons. Button1 open form2 first tab (default). I want Button
2 open form2 2nd tab. If I use form_load as suggested, my 1st button on
form1 would not focus 1st tab of form2.

> Try this: In the Form_Load event of the second form, set focus to a
> control
[quoted text clipped - 5 lines]
>  YourControl.SetFocus
> End Sub
George Nicholson - 31 Jan 2008 22:58 GMT
In Form_Open:
   Me.MyTabControl = 1

Where 1 is the PageIndex value of the tab you want pre-selected. Note that
the PageIndex of the 1st page is 0, so 1 represents the 2nd page.

Signature

HTH,
George

> Access 2003
>
> I have a button on a form to open another form with 2 tabs.
>
> What's the code to open a form with 2nd tab focused instead of default 1st
> tab?
George Nicholson - 31 Jan 2008 23:27 GMT
Two approaches. Either:

1) Use the OpenArgs argument of OpenReport to send a value that FormOpen or
Form_Load can use:
   Button1_Click: DoCmd.OpenReport "myFormWithTabs",,,,,,'0'
   Button2_Click: DoCmd.OpenReport "myFormWithTabs",,,,,,'1'

   Form_Open: Me.MyTabControl = Cint(nz(Me.OpenArgs,'0')

or

2) Open the form and set the tab from Button2_Click:
   DoCmd.OpenReport "myFormWithTabs"
   Forms("myFormWithTabs").MyTabControl = 1

All the above is aircode.
Signature

HTH,
George

> In Form_Open:
>    Me.MyTabControl = 1
[quoted text clipped - 8 lines]
>> What's the code to open a form with 2nd tab focused instead of default
>> 1st tab?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.