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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dissapearing Subforms! Make it stop! 1

Status
Not open for further replies.

ahmun

IS-IT--Management
Jan 7, 2002
432
US
I have a form that displays full employee info at the top, and then at the bottom, I have a subform of other info pertaining to the employee.

I'm trying to make a hide/show button on my form so that it:
1 - expands to show full detailed info with the subform at the bottom
2 - or hides all detailed info (showing only employee name and id number) and resizes the subform to fill the void of the hidden details.

The code to hide is written behind the click event procedure of a button I put on the form:
1 - I am setting all the detailed info (basically all the fields other than name and id number) visible property to false.
2 - I resize and reposition the subform using its .properties (ie subform.top = 1.125, subform.height = etc...)

the PROBLEM:
As soon as I get the the part where I start modifying the subform's properties, it dissapears. the code goes as follows:
Code:
    sbfEmpTrainDetails.Left = 0.0417
    sbfEmpTrainDetails.Top = 1.125
    sbfEmpTrainDetails.Width = 6.5833
    sbfEmpTrainDetails.Height = 4.2083
    'i put this in initially cuz I thot the form
    'dissapeared.. this didn't work
    'sbfEmpTrainDetails.Visible = True 
    sbfEmpTrainDetails.SetFocus

Please help out or give me a better solution!
Thanks
----------------------------- If you are born once, you will die twice.
If you are born twice, you will die once.
 
Well, it might not be quite disappearing. With this code, your subform should turn into a really, really tiny spot very near the top left corner of your form's detail section.

The problem is that you're expressing your dimensions in inches, as you do in the form's property sheet. Most properties you see in the user interface take the same values they do in VBA code, but not these. In VBA code, your units of measurement are twips. A twip is 1/1440 of an inch.

Just multiply your constants by 1440 and round off to an integer, and everything will probably be fine. Rick Sprague
 
Wow.... it feels so weird to use such large numbers! hehe

Thanks Rick. That solved the problem! If you are born once, you will die twice.
If you are born twice, you will die once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top