Scroll bars only if needed

J

Jane

Hello everyone

I hope you can help me with, what I assume is a very simple process, "if"
you know the answer. I have search on Google and can't find any help.

I have a continuous form with a vertical scroll bar. It seems that this is
either there all the time or you can disable it completely.

Is it possible to have the vertical scroll bar only shown if needed.

As an example;
If my form will hold 5 records (within the space I have allowed in the
design) and I have 4 records on the form, then the scroll bar would not be
shown. But, if there are 6 records then the scroll bar would appear.

Thank you for any assistance you can give me with this problem.

Jane Hollin


This doesn’t seem to work for some reason ?

Thank you for your assistance.

Jane Hollin
 
J

John Spencer

Try this test instead of the DCount("*"...)

IF Me.RecordsetClone.recordcount > 5 then
Me.ScrollBars = 2 'Vertical scroll bar
Else
Me.ScrollBars = 0 'No scroll bar
End if

This test should work with filtered recordsets, recordsets where the
forms record source is a saved query, or a table, or a query string. It
should also adjust if you delete records, etc.
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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