Results 1 to 3 of 3

Thread: [RESOLVED] change report controls .left property at runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Location
    Virginia
    Posts
    6

    Resolved [RESOLVED] change report controls .left property at runtime

    I have a report that is often being modified by management. Adding/deleting columns and total levels plays havoc with alignment. I want the report to self arrange all the columns.

    The left position of column 2 should start at column1.left + column1.width; column3 should start at column2.left+column2.width and so on.

    I created a little bit of code to test this and I am stuck on this error:
    "the setting you entered isn't valid for this property"

    The code appears below. As you can see I can successfully query the properties of the controls and I can even set the .visible property. But I cannot set the .left property.

    In this example the controls are labels in the heading area. But I want to do the same to text boxes in the detail area.

    Any ideas?
    Thanks,
    Jim

    Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As Integer)

    dim intA as integer
    With Me
    ' use intA to test querying these values
    intA = !lblOpenOrderAmount.Left
    intA = !lblOpenOrderAmount.Width
    intA = !lblOpenOrderCount.Left
    intA = !lblOpenOrderAmount.Left + !lblOpenOrderAmount.Width
    ' so far, so good
    ' test to see if the .visible setting can be changed without error
    !lblOpenOrderCount.Visible = false
    !lblOpenOrderCount.Visible = True

    'error occurs on the following line, no matter what I put to the right of the =
    !lblOpenOrderCount.Left = 1 ' (!lblOpenOrderAmount.Left + !lblOpenOrderAmount.Width)

    end with

    end sub

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: change report controls .left property at runtime

    Once the Print event fires all, everything should be ready to go - no more formatting changes allowed.

    Place the code in the PageHeaderSection_Format event instead.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Location
    Virginia
    Posts
    6

    Re: change report controls .left property at runtime

    Thanks very much, you nailed it.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width