Vertical Scroll Bar not going away

S

Silvio

I have a Form with a subform having the following setting:
Default View = Continuous Forms,
Scroll Bars = Vertical Only

The problem is that the subform shows the Vertical Scroll bar even if it is
not needed. Some times I only have 1 record and the scroll bar is there
still. My understanding is that the form should display the Vertical Scroll
bar only if number of record doesn’t fit in the form size. I tried to
enlarge and shrink the Form and Subform without success. Any idea on how to
solve this problem?

Thank you,
Silvio
 
J

Jeanette Cunningham

Hi Silvio,
if you want to show and hide the scroll bar depending on how many records
are showing in the subform, you can use some code.

First set scroll bars to Neither on the form's property dialog.
Use the current event for code like this:

If Me.RecordsetClone.RecordCount > 10 Then
Me.Scrollbars = 2
Else
Me.Scrollbars = 0
End If

Note: change 10 to any number that suits.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
S

Silvio

Jeanette I am aware of this method. I can not use it because the same subform
is used for a dozen of different record sources (one at a time) and each
record source have different type of records and form View. Thank you anyway.
 
J

Jeanette Cunningham

You can find out what form view is in use.
Use the form's Default View property.

From the help file.
Here are the values for 3 views:
Single Form 0
Continuous Forms 1
Datasheet 2

So your code can go
If Me.DefaulltView = 1 Then
If Me.RecordsetClone.RecordCount > 10 Then
Me.Scrollbars = 2
Else
Me.Scrollbars = 0
End If
Else
Me.Scrollbars = 0
End If

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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