Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncation?

Status
Not open for further replies.

dragonmanUSMC

IS-IT--Management
Joined
Dec 10, 2004
Messages
31
Greetings,
I have a form that has a few checkboxes,when checked, will show several fields, when not checked, will hide those fields.

My problem is I would like to truncate the form so that if the fields are not being shown there aren't any gaps in my form and ofcourse when the fields are displayed the fields all show in the appropriate order.

I appreciate any assistance offered and thank you for your time.
 
First off I assume you don't really mean "FIELDS" you actually mean 'Controls'
( Fields belong in tables - it is Controls that you put on a form )

The sort of feature that you are talking about takes some advanced & extensive coding.
Not very complex but a LOT of it.

Essentially you need to store the default 'Top' parameter of every control on the form
Then in the AfterUpdate event of each tick box control you need to cycle through the form's controls collection and where the actual 'top' parameter is greater than the 'top' ofg the line being removed then you decrement the 'top' parameter by the value corresponding to the line separation.

Repeat process in reverse if you have a way to insert lines at any point.

One other point to remember is that all distance parameters in VB default to TWIPS
There are 1440 twips per inch ( approx 567 Twips per cm )
So to set the top of control txtDemo to 4cm you need

txtDemo.Top = 4 * 567



'ope-that-'elps.




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
There is a simpler solution.

If all the controls to be hidden are below a certain point and the form just consists of the detail section, then adjust the height of the detail section accordingly.

As LittleSmudge said, measurements must be in twips.

 
Thank you for the reply I will try it out and repost if necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top