Link to home
Start Free TrialLog in
Avatar of TerenceHewett
TerenceHewett

asked on

Vertical scroll bar not always required on a form

Hi experts,

I am trying to create a continuous form that has a vertical scroll bar when the text is longer than the forms available viewing area / height, so when there is say 50 lines of text the vertical scroll bar is visible but when there are only 5 lines of text the scroll bar is invisible.  Is it possible by creating code for this or maybe a form property I have overlooked?

Any advice/code/guidance would be gratefully received.

Best regards,
Terry
Avatar of jefftwilley
jefftwilley
Flag of United States of America image

If that's not already happening with your form, then something's wrong..a corruption maybe. The scroll bar is not supposed to appear until the number of records exceeds the form height. This is an automatic function of the scrollbar.
J
Avatar of TerenceHewett
TerenceHewett

ASKER

Thanks Jeff for your post.  I think I explained it a little wrong.  The scroll bar is not showing when it is not required, so that bit is correct, but I have a dark blue background on my form, and a grey vertical bar on the right hand side of my screen that is displayed in place of the scroll bar when the scroll bar is not required.  I do not want this grey vertical bar. Is it possible to not have this?

Sorry for my wrongly worded post above.

Regards,
Terry

you can look into this....

http://www.lebans.com/customscrollbar.htm

it's really easy to use, and I do believe that changing the scrollbar color is an option. Check it out.

Your other option is to "try" to factor how tall your display area is, and do the math to multiply the number of records times the height of each record, and if greater than the form height, then set the scrollbar property that way. Seems hard! lol

J
I would be very careful with this ... if you start turning the scrollbar on and off I think you are going to get some flickering, some of it real and some of it percieved by the users. But jeff has you pointed in the right sdirection ... look at the

Neither               = 0
Horizontal Only    = 1
Vertical Only       = 2
Both                   = 3

Steve

The lebans method doesn't actually let you change colors either...I downloaded it and tried it.

here's what steve meant

Private Sub Form_Open()
Me.ScrollBars = 3
End Sub


Thanks Jeff and Steve.  I did look at the zip file Jeff, but I could not see how that could help me.  Maybe me being thick?!

I have tried the scrollbars sub and this works, but how do I get it to come back on if it is required i.e. the information on the form is greater than the display area.

Regards and thank you so much, both of you.
Best regards,
Terry
ASKER CERTIFIED SOLUTION
Avatar of stevbe
stevbe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in steve's post, 7 is the magic number that YOU have to figure out using your height ratio equation. Math 101 anyone?
the subform height at runtime can be determined by using ... me.insideheight.  All of the sizing properties and functions use twips at run time no matter what you have set for design time (inches, cm, whatever) so you again need to do a bit of math ... you will need to subtract out headers and footers if you are using them on your form ... you could grab the .Height property of any control displayed and take it from there ... now that we are getting further into it ... I usually use a datsheet instead of a continuous form (I like how it feels more like a spreadsheet, users already understand how they work). Let us know if you have any interest in persuing this a s a subform or if you are good to go with the information we have given you so far.

Steve
Thanks to both of you.  I will accept both of your complete set of posts as answers as I think they will jointly help me get to my solution in the end.  

All the best and thank you.

Terry