By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,843 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,843 IT Pros & Developers. It's quick & easy.

Required: Simple Detect Vertical Scrollbar code

P: 4
Hi all

Using MS Access 2000, Win XP

I require a quick and dirty (or all-singing and dancing) way of detecting whether a vertical scrollbar is visible on a sub-form.

apologies if posted in wrong forum - didn't see a VBA section

Jul 15 '06 #1
Share this Question
Share on Google+
2 Replies

P: 179
I'm not sure what you mean by "detecting" scroll bars. You can, however, turn the scroll bars on or off.

While in design view for the form, go into proerties, and you see a field called "scroll bars" with a pull down menu. Click on the arrow and make your selection.

Hope this helps.
Jul 15 '06 #2

P: 28
MS Knowledge Base Article KB207642 describes how you can control when the scrollbars display - the code below counts the number of rows that will be displayed before displaying the scrollbars.

Private Sub Form_Current()

' If the number of records in the subform
' is greater than 4, display the
' horizontal and vertical scrollbars.
If Me.RecordsetClone.RecordCount > 4 Then
Me.ScrollBars = 3
Me.ScrollBars = 0
End If

End Sub

I know this is sort of the reverse of what you actually want but, it might help you if what you are actually trying to do is control when scroll bars display. Of course the IF statement can return a number of lines that will display, therefore if you know how many rows can display without the scroll bars in your current subform window, you can test it against that number as follows:

Assume that the number of rows that can display without a vertical scroll bar is 6 then just use that if statement to control whatever it is that you are trying to do:

Private Sub Form_Current()

If Me.RecordsetClone.RecordCount > 6 Then
(do whatever you are trying to do here)
End If

End Sub

Hope that helps
Best Regards,
Jul 15 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.