?
Solved

Access Report Format

Posted on 2015-02-10
13
Medium Priority
?
69 Views
Last Modified: 2016-02-11
I am curious if anyone know how to format the this report so the values in the amount column show at the bottom of the field and not the top of the field. See below for example.
Example.pdf
0
Comment
Question by:jb702
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +3
13 Comments
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 40602530
HI,

You could adjust the top margin of your field to push the text down

Regards
0
 
LVL 58
ID: 40603011
That's going to be a tough one.   The problem is that any control that grows along with the section height is not available until the OnPrint event, at which point it's too late to change the formatting.

If you can live with it, I would suggest creating an additional group for the total of the line, leaving the description in the detail.

It would then look like this:

This is my
description, which has
grown to three lines
                Service charge.............................................................................. $123.45

"Service charge..........." and the total being two controls in the group footer.

If you can't live with that and it must be on the same line as the last line of the description, then the only other option is to do it as one control and format the text yourself, which includes spacing and the total.

So:
="This is my" & vbCRLF & "description, which has" & vbCrLf & "grown to three lines" & Space$(x) & Format$(Me.LineTotal,"Currency")

'x' for the spacing you'd need to figure out based on the last line of the description that your formatting and the font size.

 Personally, I'd go for the grouping.  Will always format nice.


Jim.
0
 
LVL 58
ID: 40603021
And actually, there is one other option: in the OnFormat event, if you can calculate how many lines the description will push down, then you can force the total with line feeds:

Me.TextTotal = vbCRLF & vbCRLF & VBCRLF & Format$([LineTotal],"Currency"


Jim.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 51

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 40603631
A bit tough ...

Print each record twice.
First print is used to measure the height of the expandable textbox. Then cancelled.
Second print set the height of the expandable textbox and moves the fixed height textbox to align with the bottom of the expandable textbox.

Set the CanGrow/CanShrink properties for the controls:

DetailSection: No/No
Expandable textbox: Yes/No
FixedHeight textbox: Yes/Yes

Insert this code:
Option Compare Database
Option Explicit

Private DefaultHeight   As Long
Private CurrentHeight   As Long

Private Sub DetailSection_Format(Cancel As Integer, FormatCount As Integer)

    Dim Height          As Long
    
    If CurrentHeight = 0 Then
        Height = DefaultHeight
        Me.NextRecord = False
    Else
        Height = CurrentHeight
    End If
    Me!ExpandTextbox.Height = Height
    Me.Section(acDetail).Height = Height
    Me!FixedHeightTextbox.Top = Height - DefaultHeight

End Sub

Private Sub DetailSection_Print(Cancel As Integer, PrintCount As Integer)

    If CurrentHeight = 0 Then
        CurrentHeight = Me!ExpandTextbox.Height
        Me.PrintSection = False
    Else
        Me.MoveLayout = False
        CurrentHeight = 0
    End If

End Sub

Private Sub Report_Open(Cancel As Integer)

    DefaultHeight = Me!FixedHeightTextbox.Height
    
End Sub

Open in new window

Report test/gustav
1
 

Author Comment

by:jb702
ID: 40603664
i have gone with the grouping method mentioned but i like Gustav's version better. I will add the code and see how it works.

thank you
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40604007
Gus,
Do you know if this technique would work in an .accde?
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 40604096
Good question.
So I tried and it does. Probably because the report isn't opened in designview.

/gustav
0
 
LVL 58
ID: 40604166
Nice solution!

Jim.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40604263
Nice job, Gustav.  :-)

Ron
0
 
LVL 58
ID: 40604304
I was almost there myself this morning thinking about how I might make it retreat up the page, but the retreat event occurs before OnPrint, so I didn't think it was possible.

Didn't occur to me though to cancel the print event and not move to the next record or layout!

 I love those properties too and not many use them.   It's amazing what you can do with the report engine.  Here's another slick use of them and something not many realize you can do, which is address the entire page right at the start in the page header:

http://www.experts-exchange.com/Database/MS_Access/A_8911-How-to-underlay-a-section-in-Microsoft-Access-Reports.html

Jim.
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40604318
Thanks Gus - a useful technique.
0
 

Author Closing Comment

by:jb702
ID: 41228306
Thank you
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 41232544
You are welcome!

/gustav
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

777 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