Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2010
    Location
    Reading U.K.
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi
    Im trying to get all the controls on a report when printed to be the same height as one particular one.

    I have the following code:

    Dim DescripHt

    DescripHt = Reports![Packlistprinteditnew]![InvPrint-SubReport]![Descrip].Height

    MsgBox DescripHt

    Reports![Packlistprinteditnew]![InvPrint-SubReport]![ShipMarks].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![ConType].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![Quant].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![Dimen].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![ConSize].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![GrWt].Height = DescripHt
    Reports![Packlistprinteditnew]![InvPrint-SubReport]![Volume].Height = DescripHt

    MsgBox Reports![Packlistprinteditnew]![InvPrint-SubReport]![Volume].Height

    If i put this on the main report (OnOpen) its says I cant set that property there. Help files have told me that it should be in the report section where the controls are, so tried it in the main reports detail section but it didnt work and have also tried it in the sub reports detail section. When it does work i.e.no errors, the first msgbox line tells me the height of the control as it is in design mode and then the second msgbox line tells me exactly the same number. And when printed the other controls are still at their design time height. It appears the code is running before the data is added but ive tied the code in all the different section events but to no avail. Im sure theres probably a simple answer but....?

    I have all the controls set to can grow.

    Any advice would be apprciated.

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Where are you running the Code from?

    IF you run it from the On Format Event of the Sub Report itself then it ought to work OK
    However in that case you probably do not need to use the full path to the controls,
    because they are in that section


    Code:
    Dim DescripHt
    
    DescripHt = [Descrip].Height
    
    MsgBox DescripHt
    
    [ShipMarks].Height = DescripHt
    [ConType].Height = DescripHt
    [Quant].Height = DescripHt
    [Dimen].Height = DescripHt
    [ConSize].Height = DescripHt
    [GrWt].Height = DescripHt
    [Volume].Height = DescripHt
    Andrew

  3. #3
    New Lounger
    Join Date
    Jan 2010
    Location
    Reading U.K.
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi
    Thanks for reply.
    Iíve added the code to the OnFormat event on the subreports detail section but something not quite right. It runs with no errors but controls still not changing to same size as the description box. (See attachment).
    Any help would be greatly appreciated
    Cheers
    Attached Images Attached Images

  4. #4
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I am guessing that the description box has the Can Grow Property set to yes.
    If this is the case, then the size of that control can change, so I am not sure that setting the size of the other controls will work,
    unless you set the size to be bigger that is needed.
    Someone may be able to say if this is true or not.

    I am assuming that the size is to get all the boxes to appear the same size.
    You might be better just having a horizontal line at the end of each record and no border on the boxes.
    Andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •