Solved

Report Control Left Margin

Posted on 2013-11-23
4
358 Views
Last Modified: 2013-11-24
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?
0
Comment
Question by:Lawrence Salvucci
  • 2
  • 2
4 Comments
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39672215
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
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 39672726
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
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
ID: 39672956
I got it working. Thank you for your help!
0
 
LVL 36

Expert Comment

by:PatHartman
ID: 39673316
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

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question