Solved

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

Posted on 2013-11-13
5
644 Views
Last Modified: 2013-11-14
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.
0
Comment
Question by:Liberty4all
5 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
afaik, that setting is only available in design view...
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
Comment Utility
and you can flip to design view and do it, but that is problematic on a number of levels, the first of which is it de-compiles the app and makes it run slower.

Second problem is you cannot run as a MDE/ACCDE then.

Third one is that design view changes require exclusive access to the DB.  Not an issue if everyone has a copy of a front end, which is what will have to happen if more then one user uses it (you should be doing this anyway).

Jim.
0
 
LVL 21
Comment Utility
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!


0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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.
0
 

Author Closing Comment

by:Liberty4all
Comment Utility
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.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now