Scrolling on a form

  • Thread starter John S. Ford, MD
  • Start date
J

John S. Ford, MD

I'm working in MSAccess 2000. I have a dialogue box form with many controls
that the user has to scroll down to access all the controls. It scrolls
automatically if the user enters data and hits <return> or <tab> to get to
the next control in the tab order. The "cycle" property of the form is set
to "Current Record".

What I want is for the form to scroll ALL the way to the top after the user
accesses the bottom control (a textbox) and hits <return> or <tab> with the
focus ending on the top control of the same record.

The problem is that although the focus does go to the top control, the form
doesn't scroll completely to the top. This is visually confusing because
there is some text on the form that is cut off at the top of the form.

I've attempted to solve this by creating a "dummy" cmdbutton at the top-left
of the form, setting it's "transparent" property to yes, and making the
"setfocus" event send the focus to the first "real" control of the form like
I want. Unfortunately, this doesn't seem to work as the form is still not
scrolled completely to the top.

As an aside, if I set the "cycle" property to "All Records", my solution
works perfectly but of course, my intent is to stay only on the same record.

Any ideas on how to fix this?

John
 
S

Software-Matters via AccessMonster.com

With the cycle set to current record, the next property tabbed to after the
last control should be the first i.e the top. Where is it going at the moment?

In design view you can change the tab order by first selecting the detail
section and then choosing View/Tab Order from the menu.



I'm working in MSAccess 2000. I have a dialogue box form with many controls
that the user has to scroll down to access all the controls. It scrolls
automatically if the user enters data and hits <return> or <tab> to get to
the next control in the tab order. The "cycle" property of the form is set
to "Current Record".

What I want is for the form to scroll ALL the way to the top after the user
accesses the bottom control (a textbox) and hits <return> or <tab> with the
focus ending on the top control of the same record.

The problem is that although the focus does go to the top control, the form
doesn't scroll completely to the top. This is visually confusing because
there is some text on the form that is cut off at the top of the form.

I've attempted to solve this by creating a "dummy" cmdbutton at the top-left
of the form, setting it's "transparent" property to yes, and making the
"setfocus" event send the focus to the first "real" control of the form like
I want. Unfortunately, this doesn't seem to work as the form is still not
scrolled completely to the top.

As an aside, if I set the "cycle" property to "All Records", my solution
works perfectly but of course, my intent is to stay only on the same record.

Any ideas on how to fix this?

John

--
<a href="
http://www.software-matters.co.uk/bespoke-database-design.html">Bespoke
Access Database Development</a>
<p>Software Matters</br>
Straightforward solutions that work</p>
 
J

John S. Ford, MD

The problem isn't with the tab order or the cycling property. It's that
although the dummy control (which is first in the tab order) gets the focus
after hitting <return> or <tab> on the last control but the form doesn't
scroll to the absolute top. I have the following routine attached to the
"GotFocus" event:

Private Sub cmdDummyTopLeft_GotFocus()
txtPatientMRNumber.SetFocus
End Sub

John
 
L

Linq Adams via AccessMonster.com

What's up, Doc? How far from the top of the form is using the dummy command
button leaving you? If it's only a tad, I'd try using the same technique, but
scrap the command button and use an unbound textbox box, again in the top
left corner. Reduce the textbox in size to a pinpoint (it won't even be
noticeable) and use the same code. I think this will force the "focus" even
further up the form.

As a general comment on form design I have to say that most experienced
developers subscribe to the premise that having a form that is so long that
you have to scroll to see it all is very, very user unfriendly. Much better
to divide your controls into logical groups and place them on the pages of a
Tabbed Control. You can use code to move from one tabbed page to the next
when doing data input, and clicking on a tab to move around the form is far
easier then capturing the scroll bar and scrolling.
 
L

Linq Adams via AccessMonster.com

Sorry, hit the send button too early. Meant to ask, are you, perhaps, also
know as the "California Medicine Man?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top