Update Rectangle

H

Heiko K Stugg

I am using a rectangle to display how full or empty something is; the
displayed information is based on user input from over 20+ bound textbox
fields and is also based upon an option group. The only way that I have been
able to update the rectangle fill is to use an afterupdate event for each
bound textbox field used. I assume that there has to be a better way of doing
that, other than copying the same data for bound textbox field.

Can any one help me with this?
 
J

J

Have one rectangle be the "liquid" and one be the "container"... I'm
going to call them boxLiquid and boxContainer. Set the fill on
boxLiquid to a solid color. Size both rectangles on top of eachother.
Save your form.

In your form, under the afterupdate event use the following code:

Private Sub Percentage_AfterUpdate()
Dim Percentage as single
Percentage = 'You fill in the expression for a decimal percentage
here!

boxLiquid.Top = boxContainer.Top + (1 - Percentage) *
boxContainer.Height
boxLiquid.Height = Percentage * boxContainer.Height
End Sub

~J
 
T

TonyT

I've used very similar code to do the same with a case percentage statement
to vary the colour of the *liquid* at the same time - looks good.

TonyT..
 
K

kingston via AccessMonster.com

Did you try using the After Update event for the entire form? I'm assuming
all of the textboxes are in the same form. Otherwise, create a public
function and call it from the forms or the textboxes.
 
Top