By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,225 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,225 IT Pros & Developers. It's quick & easy.

change report controls .left property at runtime

Expert 100+
P: 1,221
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
Aug 12 '09 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,221
Got the solution, the problem is I put the code in the Print event and I should have put it in the Format event code. Works great now :)
Aug 13 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.