Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Report Control Left Margin

Posted on 2013-11-23
4
Medium Priority
?
378 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 40

Accepted Solution

by:
PatHartman earned 2000 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 40

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

877 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