Solved

Report Control Left Margin

Posted on 2013-11-23
4
325 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 34

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 34

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now