Link to home
Start Free TrialLog in
Avatar of Bryan Schmidt
Bryan SchmidtFlag for United States of America

asked on

Moving a control to front or back in an Access 2003 report using VBA

I have some rectangles in an Access 2003 report that expand or contract based upon values in certain fields.  The rectangles are essentially "stacked" upon one another so the shorter ones are not covered up by those which are longer.  This process works well but occassionally the smaller ones have values that exceed the next size and thus cover up those that are usually longer.  The rectangles display in color which requires the back style property to be normal.  Thus, setting the back style property to transparent is not an option.

I think the solution is to add code to send the short rectangle control to the front or back depending on its length relative to other fields.  What I don't know is the syntax needed to accomplish this.  I'm guessing it would be similar to the following.

If Me. Box1.value > Me.Box2.value then
Me. Box1.SEND TO BACK
Else
Me.Box1.SEND TO FRONT
End if

I would appreciate any suggestions on how to do this, or if another approach would be better.
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

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
ASKER CERTIFIED 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
I uses the following code to dynamically resize "Boxes" to fit t

see: http://lebans.com/PrintLines.htm

PrintLinesClass - Create Vertical lines, Borders and boxes with the addition of a simple to use Class to your project.


    How to create a margin for your TextBox.
    How to Draw Vertical lines the entire vertical length of your Report.
    How to Draw a Grid.
    How to force the contents of a Memo field to fit within a fixed sized control.
    Lots of other stuff!


Yes, but the problem is not changing the size, but the fact that changing the size ruines the layout they've setup, which is a "stacked" series of rectangles.

They need to change the z layout order.

I wonder though if all the rectangles could be drawn in order in the OnPage event?

A thought...

Jim.
Avatar of Bryan Schmidt

ASKER

For now I will accept the response of capricorn1 and Jim Dettman.  I can live with what I have and recognize the issue is essentially a limitation within Access.  Jim's second comment suggests a possible alternative to consider but time constraints prevent me from exploring it.  I appreciate everyone's quick response.  I will keep the comments from the HiTechCoach for future reference.