Up/Down Alignment of field data in Report (1 Viewer)

Ashfaque

Student
Local time
Today, 14:48
Joined
Sep 6, 2004
Messages
894
Hi,

I wish to set up up and down alignment of data in report that based on it length of characters.

Example: if the text box placed in details section of report that has 11 cm width and Height 2 cm to let 2-3 lines appear.

When the data length is less than particular number (let us say 70) then it should appear in left mid of the text box which has same space at up and down. If the length of characters are greater than 70...(let us say around 130 so it should appear in 2 lines adjusting top and bottom part of text box.

I hope I explained properly. At present, If there are less than 70 character in field it is appearing at top of text box. Please see pic. If see the first 1 & 2 data line, they are adjusted because character length is > 70. But at 3 to 7....all text line is appeared on top of text box which I want it to be in middle.

To make this happen, I wrote few line on Load event of report but doesn't work out.

Private Sub Report_Load()
Dim x As String
x = Len(Me.AuthDesc1)
If x > 70 Then
Format (Me.AuthDesc1.TopMargin = 0.25)
Else
x = ""
End If
End Sub

Can someone advise on this issue?

Thanks,
Ashfaque
 

Attachments

  • MReport.jpg
    MReport.jpg
    61.1 KB · Views: 340

June7

AWF VIP
Local time
Today, 01:18
Joined
Mar 9, 2014
Messages
5,463
This is proportional font. What you want will only work with non-proportional font.

Load event will not work. Use Format or Paint event of section controls are in. These events only execute for PrintPreview or direct to printer.

Not valid use of Format() function. Remove it. Simply: Me.AuthDesc1.TopMargin = 0.25

x should be declared as an integer and not set to an empty string, set it to 0.
 

Ashfaque

Student
Local time
Today, 14:48
Joined
Sep 6, 2004
Messages
894
Thanks June7,

I tried even using format and paint event of detail section of report follows:

Dim x As Integer
x = Len(Me.AuthDesc1)
If x > 70 Then
Me.AuthDesc1.TopMargin = 0
Else
If x < 70 Then
Me.AuthDesc1.TopMargin = 1.25
End If
End If
x = 0

but still no effect.

Regards,
Ashfaque
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:18
Joined
Oct 29, 2018
Messages
21,449
Hi. I don't have an answer for you right now but just wanted to make sure I understand what you're asking. You only want to have all the lines with normal spacing in the middle with even spacing at top and bottom rather than an even spacing for all the lines in the box, correct?
 

June7

AWF VIP
Local time
Today, 01:18
Joined
Mar 9, 2014
Messages
5,463
Have to use TWIPS measurement. 1 inch = 1440 TWIPS.
 

Ashfaque

Student
Local time
Today, 14:48
Joined
Sep 6, 2004
Messages
894
Yes sir, I just want to appear the line in mid / center in the text box if the data length is of single line. If the characters are more than one line ( mean > 70 ) then it should make in 2 lines and appear them in center
 

Users who are viewing this thread

Top Bottom