By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,660 Members | 1,953 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,660 IT Pros & Developers. It's quick & easy.

Force a Left Scroll

P: 34
I have a form which is very wide (some 30 columns). On refreshing the data, I want to, automatically, force a "scroll left" (as if I clicked on the scroll bar and moved to the extreme left), so that the window will show the fileds in column 1,2 .... etc.

Many thanks in anticipation.
Jan 29 '09 #1
Share this Question
Share on Google+
6 Replies

Expert 5K+
P: 8,634
Without using SendKeys, a little trick that I use is to place a very small Text Box in the extreme Upper Left Corner of the Form, then after Updating the Form, set focus to it as in:
Expand|Select|Wrap|Line Numbers
  2. Me![<Text Box Name>].SetFocus
Jan 29 '09 #2

P: 34
Thanks. I'd thought of this already, but had problems making it work - (I'd set it to Visible=No, which VBA didn't like. So, was looking for a more techy answer.

Got it sorted and working a treat now.

Thanks again.
Jan 29 '09 #3

Expert Mod 15k+
P: 31,487
Would you like to share your solution with us here, in case anyone else is stuck with a similar problem?
Jan 29 '09 #4

P: 34
It's as Adezii said in his response. Set-up a text box on extreme left of form and atfer your 'refresh' code, add:

Me![<Text Box Name>].SetFocus

Just make sure the texbox is set to 'visible' (with foreground colour set to background, so that you don't actually see anything).
Jan 29 '09 #5

Expert 5K+
P: 8,634
I've tried the following code with limited success, it involves:
  1. Setting the Focus to the Form, and not a Control contained within it.
  2. Simulate the hitting of the Left Arrow Key with SendKeys for a specified number of times (4 in this case).
    Expand|Select|Wrap|Line Numbers
    1. Forms!<Your Form Name>.SetFocus
    2. SendKeys "{LEFT 4}", True
  3. Good Luck
Jan 30 '09 #6

Expert 2.5K+
P: 3,532
From Access Help:
If a form contains controls for which the Enabled property is set to True, you can't move the focus to the form itself. You can only move the focus to controls on the form. In this case, if you try to use SetFocus to move the focus to a form, the focus is set to the control on the form that last received the focus.
Which may account for the "limited success" you mentioned, ADezii. The focus, after moving left four times, will go to a different control, depending on which control last had focus on the form.

Your original suggestion actually works just fine, as the OP said. Another method, besides setting the "phantom" control's background/forecolor to the same as the background color for the Detail Section, would be to place the control in the top, left-hand corner of the section, then reduce it in size to a pinpoint. It can receive focus, but you don't really notice it.

Linq ;0)>
Jan 30 '09 #7

Post your reply

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