Okay, I'm assuming you're using the relevant report section's OnFormat event to try to do this, yes? Must admit I've never tried moving controls, but if Access won't let you modify a control's Top property in this event, have you considered having two controls, one in the 'before' position that's visible and one in the 'after' position that is invisible. Then you can use the report section's OnFormat event to toggle their visibilities, i.e.
Code:
Control1.Visible = Not Control1.Visible
Control2.Visible = Not Control2.Visible
And setting control visibility in the OnFormat event definitely does work!
You can change the top, left, width property of a control or label through code. But, you must use twips value to move the control. Twips are 1/1440". So, if you want to move a control everyother time from one spot to another for example use this VBA code in the OnFormat of the Detail Section: If Me.CONTROL_NAME.Top = 240 Then
Me.CONTROL_NAME.Top = 0
Else
Me.CONTROL_NAME.Top = 240
End If
The 240 value of twips is equal to .1667 inches. So, you probably were moving the control but it wasn't visible. If you moved it one inch by assigning 1 to the Top property it would only move 1 twip. very small.
Let me know if this helps you.
Bob Scriver
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???
I'm so stupid .... After reading your reply I've realized that I've put the code into OnPrint event, and that's why it wouldn't allow me to modify control's Top property.
Well it's me again... I have one more problem now..
I want to modify height of the ReportHeader, and I get the error message that says "This property is read-only and can't be set.".
This is the code i'm using :
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.