Change the height of a form in code

Hi, I have on the CRM Menu a Relations menu which will open the contact card with only persons and a menu Companies which will open the same contact card with only companies. Now when i open the contact card for companies the height of the form has to be 1500 because i want to add an extra subform on the form and for persons it has to be 1100. i’ve tried to change the height with the following code in the OnOpen Form() trigger if type = type::person then Currform.height(1100) else Currform.height(1500); Everytime i open the card for companies it opens the form with the height 1100 and it adds scrollbars to the form. Does anybody know what i am doing wrong !! Wendy

Where exactly are you putting this code. if type = type::person then Currform.height(1100) else Currform.height(1500); The code seems to be right but i feel that the place where this code is being called is incorrect. Thanks Best regards Suresh. New York.

Hi Suresh, i have written the code in the OnOpenform() trigger of the contact card. but i think the problem is because i added an extra subform on the bottom of the card which i only want to see with companies. regards, Wendy

Hi Wendy, No…No… that wont work, instead of creating a subform why dont you create a new tab on the form and link using the subform link and you would get the same result. This way you dont have to worry about the height or width. Thanks Best regards Suresh. New York.

Something along these lines wil work (assuming you call the form with a tablefilter set in the RunFormView property): FILTERGROUP(3); IF GETFILTER(Type) <> '' THEN BEGIN CompanyCall := (GETFILTER(Type) = 'Company'); IF CompanyCall THEN // Default height CurrForm.HEIGHT := 10780 ELSE CurrForm.HEIGHT := 8000; // Hide subform if Type=Person CurrForm.SUB.VISIBLE(CompanyCall); END; FILTERGROUP(0); Insert the code in OnOpenForm trigger and remember to name the subform ‘Sub’. I would not recommend this approach, though. Create 2 separate forms - it’ll make things easier in the long run… [;)]