Report Control Left Margin

I have a control on my report that I want to shift the margin over .5" when there is a value in another control. If that other control is empty I want the margin of this control to stay left justified. If it's not null then I want to move the left margin .5". How do I write this in vba code and which event of the report should this go in?
LVL 1
Lawrence SalvucciInformation Technology ManagerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
PatHartmanConnect With a Mentor Commented:
The code goes in the Format event of the section that contains the controls you want to modify.
If Me.somecontrol & "" <> "" Then
    Me.someothercontrol.LeftMargin = .5
Else
    Me.someothercontrol.LeftMargin = 0
End If

Open in new window

0
 
Lawrence SalvucciInformation Technology ManagerAuthor Commented:
That doesn't seem to be working. I tested it and it doesn't seem to be moving the left margin. Here's what I have in the format event:

If Me.txtResultsValue & "" <> "" Then
    Me.Results.LeftMargin = 0.5
Else
    Me.Results.LeftMargin = 0
End If

Open in new window

0
 
Lawrence SalvucciInformation Technology ManagerAuthor Commented:
I got it working. Thank you for your help!
0
 
PatHartmanCommented:
You probably won't see a difference unless the control is full.  Try making the offset larger so that you can see it do something.  Perhaps, LeftMargin is not the property you want to adjust.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.