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 / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

How to scroll a MS-Access form with VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hstijnen - 31 Aug 2005 12:55 GMT
Hi,
I've a form in MS-Access that opens with the horizontal scroll position not
on top of the form. What can I do to make scroll position on top?

Thanks for help

Henk
Gijs Beukenoot - 31 Aug 2005 14:18 GMT
hstijnen gebruikte zijn klavier om te schrijven :
> Hi,
> I've a form in MS-Access that opens with the horizontal scroll position not
[quoted text clipped - 3 lines]
>
> Henk

Not sure, but could it have anything to do with the first element
(control) that gets the focus (having taborder 0 (zero) or,
programatically setting the focus to a control)?
hstijnen - 31 Aug 2005 14:26 GMT
I've a mainform which contains a tabcontrol with several tabs. On every tab
there is a subform. The form opens on the first tab. The uppermost control
has focus. This control is rather on top of the window, so that the tabs of
the tabcontrol aren't visible. And I have to scroll up to see them.
Now I'm looking for a piece of VBA to do that in the Form_Open

> hstijnen gebruikte zijn klavier om te schrijven :
> > Hi,
[quoted text clipped - 8 lines]
> (control) that gets the focus (having taborder 0 (zero) or,
> programatically setting the focus to a control)?
David C. Holley - 31 Aug 2005 16:57 GMT
Can you email me a screen print of the form?

> I've a mainform which contains a tabcontrol with several tabs. On every tab
> there is a subform. The form opens on the first tab. The uppermost control
[quoted text clipped - 15 lines]
>>(control) that gets the focus (having taborder 0 (zero) or,
>>programatically setting the focus to a control)?
David C. Holley - 31 Aug 2005 14:53 GMT
Just a guess, but is it the scroll bar for the FORM or the ACCESS
application window. Depending on the sizing of the form, its positioning
and the Access window, you may get a horizontal scroll bar for the
window which can be confused with the one for the FORM. Its difficult
for me to provide further help since its a VISUAL thing. But try playing
with the MIN/MAX buttons on the FORM. Also, if the HEIGHT of the form is
taller than the Application window that would cause the Application
scroll bar to appear. Side question - Is the form set to display a
single record or continous records?

> Hi,
> I've a form in MS-Access that opens with the horizontal scroll position not
[quoted text clipped - 3 lines]
>
> Henk
hstijnen - 31 Aug 2005 15:32 GMT
First I'm sorry, for I meant the VERTICAL scroll. It's indeed the scrollbar
of the FORM.  The mainform's only function is to contain the tabcontrol with
the other subforms. The mainform has no recordselector, navigation buttons or
dividing lines.
I'm looking for some VBA code to scroll the mainform.

> Just a guess, but is it the scroll bar for the FORM or the ACCESS
> application window. Depending on the sizing of the form, its positioning
[quoted text clipped - 13 lines]
> >
> > Henk
Stephen Lebans - 31 Aug 2005 15:48 GMT
For the simplest method using SendMessage see:
http://www.lebans.com/loadjpeggif.htm

and
for a more detailed solution see:

http://www.lebans.com/setgetsb.htm
SetGetSB.zip is a database containing functions to allow a user to Set
or Get the current position of a ScrollBar Thumb for a Form.

NEW - Apr. 02/2000 The current ScrollBar position is equal to the
current Record Number being displayed at the Top of the Form.

Works in Form or Datasheet view.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> First I'm sorry, for I meant the VERTICAL scroll. It's indeed the scrollbar
> of the FORM.  The mainform's only function is to contain the tabcontrol with
[quoted text clipped - 19 lines]
> > >
> > > Henk
hstijnen - 31 Aug 2005 16:35 GMT
Thanks, Stephen,
I've downloaded your setgetsb and tried the following code in the first
subform:

Private Sub subfrm_FG_Enter()
i = fGetScrollBarPos(Form_Mainform2)  ' --> result: i = 32
i = fSetScrollBarPos(Form_Mainform2, 0) ' --> i = 0
End Sub

It seems to work, but Mainform2 continues to be scrolled, so that the tabs
were still not visible.
By the way, is my solution to arrange several forms "best practice"?

> For the simplest method using SendMessage see:
> http://www.lebans.com/loadjpeggif.htm
[quoted text clipped - 50 lines]
> > > >
> > > > Henk
David C. Holley - 31 Aug 2005 17:06 GMT
Regarding what I just posted. If you go to a doctor and ask for
something because you've got a piercing pain in your arm, the morphenine
that he gives you will take away the pain but not do anything for the
piece of steel in your arm. Being able to move the scroll bar won't
neccessarily fix the underlying problem.

> Thanks, Stephen,
> I've downloaded your setgetsb and tried the following code in the first
[quoted text clipped - 79 lines]
>>>>>
>>>>>Henk
Stephen Lebans - 31 Aug 2005 20:05 GMT
I stated that you should look at the simpler of the two methods found in
the first project I pointed you to here:
http://www.lebans.com/loadjpeggif.htm

Look at the ScrollToHome Sub found in the standard code module
"modStdPic".

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Thanks, Stephen,
> I've downloaded your setgetsb and tried the following code in the first
[quoted text clipped - 63 lines]
> > > > >
> > > > > Henk
David C. Holley - 01 Sep 2005 14:32 GMT
Based on the screen image that you sent me, it looks as if Access is
scrolling up to put the first control in the tab order at the top of the
screen. No idea as to way, since to me thats counterintuitive. Try this,
add some space above the tab control. In that space add a command button
(it doesn't have to be large, just there). Set its TRANSPARENT property
set to true. Finally change the tab order to ensure that the command
button is the first in the sequence. Make certain that the command
button is NOT a part of the tab control, just above it.

> I stated that you should look at the simpler of the two methods found in
> the first project I pointed you to here:
[quoted text clipped - 117 lines]
>>>>>>
>>>>>>Henk
David C. Holley - 31 Aug 2005 16:59 GMT
What I'm getting at is that I think that theres a design issue here and
that if you find it and fix you won't need the code. Could you please
send me a SCREEN PRINT showing the form and the screen real estate
around it? DavidCHolley@netscape.net

> First I'm sorry, for I meant the VERTICAL scroll. It's indeed the scrollbar
> of the FORM.  The mainform's only function is to contain the tabcontrol with
[quoted text clipped - 19 lines]
>>>
>>>Henk
 
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.