Vertical Scroll Bar not going away

  • Thread starter Thread starter Silvio
  • Start date Start date
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
 
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
 
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.
 
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
 
Back
Top