Set Default for Tab Control

shieriel

Registered User.
Local time
, 00:01
Joined
Feb 25, 2010
Messages
116
I use tab control on my form for the monthname and created queries for the monthly summary of records.
Can i set the default tab to always open on the current month? When i open the form it is always showing the January tab, and i have to click on March which is the current month..
 
This is something intrusting. more VBA coding needed to do the task.
1 - Get the Month from the current date
2 - Find the Tab on the form which match the Current Month
3 - Set Focus on that Tab

hmmmm.... intrusting ;)
 
This is something intrusting. more VBA coding needed to do the task.
1 - Get the Month from the current date
2 - Find the Tab on the form which match the Current Month
3 - Set Focus on that Tab

hmmmm.... intrusting ;)


I dont know where and how to start for this..:confused:
i have no idea, sorry just a beginner...:o
 
The Month() function will return the month number, so you could use;
Code:
Month(Date())
to return the month number for today's date.

If you want the month name then have a look at the MonthName() function in which case you could use;
Code:
MonthName(Month(Date()))
to return the month name of today's date.
 
Now assuming your tabs use the month name as their name, you can then use the following to set focus on today's month named tab;
Code:
Me.MonthName(Month(Date())).SetFocus
 
Now assuming your tabs use the month name as their name, you can then use the following to set focus on today's month named tab;
Code:
Me.MonthName(Month(Date())).SetFocus


Hi Sir John, How should i apply this on my form? I use month name for my tabs (January, February, March,....December). I tried to apply this on "Got Focus" event property on my form but nothing hapens. I also tried "on Load" and "on Open" and i got a "compile error" > "Method or data member not found":confused:
 
Actually it should be:

Code:
Me.[COLOR=red][B]Controls([/B][/COLOR]MonthName(Month(Date()))[COLOR=red][B])[/B][/COLOR].SetFocus
 
Actually it should be:

Code:
Me.[COLOR=red][B]Controls([/B][/COLOR]MonthName(Month(Date()))[COLOR=red][B])[/B][/COLOR].SetFocus

It works! Thank you very much.....:D
 

Users who are viewing this thread

Back
Top Bottom