| Chat with a LIVE Microsoft
Access Expert! |
||||
|
||||
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to programmatically align the control's position (Left,Top)
I want to progammatically align the report controls position.
I have a control with left=2.7 in the Design view property. I want to set programmatically set this value to 3.0 or other value accoring to a parameters. The problem is that when I set this property at the event Report-Open, the control appears always in another position regardless of the left value, i.e appears always at the new constant position. What is the problem you think? |
| Sponsored Links |
|
#2
|
|||
|
|||
|
A,
The measurements are in "twips". A twip is something like 1/1440 of an inch. Experiment --> .Left = 1440 should move it one inch. Wayne |
|
#3
|
|||
|
|||
|
Thanks for support,
|
|
#4
|
|||
|
|||
|
A,
Gload to help. btw, why are you moving them? Are you resizing fields due to data length? Wayne |
|
#5
|
|||
|
|||
|
I had occasion to do something like this once:
I had eight buttons, but never more than five would be active at any one time due to the nature of the functions on this rather complicated little form. So what I did is I found the first button and aligned it so its top was 1 twip plus the top plus the height of a line that I drew as a border for all control buttons. The left of this button aligned to the left of the border line. Then the next active button I moved to the same top and to a left equal to 1 plus the left plus the width of the button to the left. I did this for as many buttons as were active and disabled all other buttons, which I aligned to a place that wasn't a control. And they were made not visible, too. Also not tab stops. While I was at it, I also identified the label controls and manipulated them, too. As I clicked a button, part of the underlying code computed which buttons became "legal" in that context. I made the button placement code a subroutine that would traverse all buttons, placing the active ones and displacing the inactive ones. Obviously, activation and deactivation were external to the placement code. The buttons were separately activated based on a context subroutine that decided which buttons were legal at the time. So eventually this narrowed down to two subroutines called during each button-click event. It was a pretty slick little form if I do say so myself.
__________________
I'm a certified grandpa and proud of it. Not quite so valuable after the MVP status expired. |
|
#6
|
|||
|
|||
|
Dear WayneRyan,
Thanks for your question. I use this because in a report I have five fields. I want to display these fields according to the user option. Before displaying the report, I show a form asking the user to check the control names, he want to see in the report. Thus, if the user selcect only 2 controls out of 5 controls, then I distribure the report vertical space on 2. then align the report but moving these fields using the left properies. I will be very happy if you can give me a way to do this without this long way. Is it possible at the report view to give the user the option to hide/show report fields? Thanks |
|
#7
|
|||
|
|||
|
Accessor,
There are no *easy* ways to do this. You can see by Doc's dissertation that as your needs get more complex, the amount of code and effort increases also. But, it can make things look really nice sometimes. Thanks for the input Doc. If you name your controls appropriately, you can save some work by looping through them in your code, but you still have to implement the logic. It is definitely "possible" to get user input after the report opens, but for practical purposes your approach is the proper one. Wayne |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "Property cannot be set" error with Rich Text Box controls? | prlaba | Forms | 0 | 10-24-2006 06:37 AM |
| auto style form controls - position and appearance | antonyx | Forms | 0 | 10-04-2006 03:17 AM |
| Controls not displaying on form | Mia | Forms | 0 | 03-11-2006 06:18 PM |
| Controls on subform disappear | sard0nicpan | Forms | 1 | 03-31-2005 01:28 PM |
| Data in controls and same data in Datasheet view also. Subform not updating. !! HELP | hallian92 | Forms | 0 | 05-08-2002 05:27 PM |