My Assistant
![]() ![]() |
|
|
Aug 4 2010, 06:48 AM
Post
#1
|
|
|
UtterAccess Guru Posts: 931 |
I have a tabbed form. When someone clicks on a tab, what would be the code I need to put in the OnClick event to make sure the form scrolls to the top?
Thank you. Brandi |
|
|
|
Aug 4 2010, 06:55 AM
Post
#2
|
|
|
UtterAccess Ruler Posts: 1,621 From: Arkansas |
Docmd.gotocontrol ([fieldname]) ,top of page
the field name would be the control that is at the top of the page. |
|
|
|
Aug 4 2010, 06:55 AM
Post
#3
|
|
|
UtterAccess VIP Posts: 638 From: Sydney, Australia |
Hi Brandi,
This should do it: CODE DoCmd.GoToPage 1 But I have to ask why you need to scroll it up. Is your form taller than the screen? It'd poor design to do that; I'd strongly recommend you redesign your form if that's the case. |
|
|
|
Aug 4 2010, 07:02 AM
Post
#4
|
|
|
UtterAccess Editor Posts: 6,718 From: Capital District, NY, USA |
And yet another method is to set the focus to a control anywhere on the form (controls in tabs selects that tab)
Me.ControlName.SetFocus |
|
|
|
Aug 4 2010, 07:09 AM
Post
#5
|
|
|
UtterAccess Guru Posts: 931 |
Thank you all. The reason I have to do this is there are 2 users. One uses a very old monitor with 600 x 800 resolution and most of the screens need to be sized to fit for her so she doesn't have to scroll around. A second user has a larger monitor and she wants to be able to see lots of information on one tab and therefore it is set up so she can scroll vertically and we can pack more information on her tab.
|
|
|
|
Aug 4 2010, 07:17 AM
Post
#6
|
|
|
UtterAccess Guru Posts: 931 |
I tried DoCmd.GoToPage 6 where 6 is the number for the tab in the Page Index Property.
However, when I try to use it, I get an error that the page does not exist. GoToControl doesn't seem to work either. Do I use the full name of the form and then the subform and field on the subform that is at the top of my tab? |
|
|
|
Aug 4 2010, 07:19 AM
Post
#7
|
|
|
UtterAccess VIP Posts: 638 From: Sydney, Australia |
Funny, I could have sworn I said
CODE DoCmd.GoToPage 1
|
|
|
|
Aug 4 2010, 07:25 AM
Post
#8
|
|
|
UtterAccess Guru Posts: 931 |
The tab which is tab number 6 has four subforms on it. When ever I click on the tab, it sets the focus in the last subform. I have tried
GoToControl subform1 GoToControl mainformname!subform1name Me.subform1name.SetFocus DoCmd.GoToPage 6 All have failed. Do you know what I am missing? Thank you. Brandi |
|
|
|
Aug 4 2010, 07:27 AM
Post
#9
|
|
|
UtterAccess Editor Posts: 6,718 From: Capital District, NY, USA |
Me.Subform1ControlName.SetFocus
Have you considered giving the two users seperate forms to avoid the scrolling problem? |
|
|
|
Aug 4 2010, 07:29 AM
Post
#10
|
|
|
UtterAccess VIP Posts: 638 From: Sydney, Australia |
Funny, I could have sworn I said:
CODE DoCmd.GoToPage 1 For heaven's sake, at least test it. Also, change the TabIndex of the topmost control to 1. |
|
|
|
Aug 4 2010, 07:36 AM
Post
#11
|
|
|
UtterAccess VIP Posts: 8,138 From: CT |
if you are using tabs, don't you have to use the tabctl to change the tab?
tabctl0.pages(6).setfocus ??? |
|
|
|
Aug 4 2010, 07:55 AM
Post
#12
|
|
|
UtterAccess VIP Posts: 638 From: Sydney, Australia |
GoToPage operates on the form's page, not the tab's page.
|
|
|
|
Aug 4 2010, 09:40 AM
Post
#13
|
|
|
UtterAccess Guru Posts: 931 |
I do not want to go to the top of the first tab but instead the 6th tab.
Anyway, the suggestion to look at the tab control index turned out to be the problem. The 6th tab has 4 subforms on it and the subforms were rearranged but the tab order was not. So once I changed the tab order of those subforms, all is well. Thank you all. Brandi |
|
|
|
Aug 4 2010, 12:56 PM
Post
#14
|
|
|
UtterAccess VIP Posts: 638 From: Sydney, Australia |
QUOTE I do not want to go to the top of the first tab but instead the 6th tab. (IMG:style_emoticons/default/crazy.gif) But I'm glad it's working now. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 06:23 PM |