report problem

hmongie

Registered User.
Local time
Today, 17:41
Joined
May 17, 2003
Messages
99
I posted this a while back but didn't get any answers. If someone can help please let me know. thanks...
..............................................................

Okay, I tried but could not get this working.


I'm trying to get a report that will look like the example below, where the report will have numbers that are assigned to the beginning of each line. Anyone with any ideas, please help.


.............Report...........

Name: Johnny Depp <------- name field
Date: 01/02/04 <------- date field

REPORTING MY ACTIVITIES <-------- title field

<---------below is one memo field ---------->
1 Hey there, today is a great day. I love to
2 see you but I had to work. Maybe, if you have
3 some time, we can go catch lunch today. If not
4 then it's okay. Can you let me know if you would
5 would like this? Well, I gotta get back to work, so
6 I'll call you someother time.
7
8 Bye,
9 Love always,
10 Johnny Depp
11
12

.....................END OF REPORT..........................
 
h,

I didn't put a lot of time into this. I've never had a need for
something like it.

Put a new textbox on your report. Name it txtNumber. Your
memo field is MyMemo. Both controls have the CanGrow/CanShrink
property set to YES.

In the form's DetailFormat event, put the following code.

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngCharsWide As Long
Dim lngLinesLong As Long
Dim i As Long

'
' Find out how wide the reports memo control is, this will give an
' idea of how many chars would print.
'
' Then divide into memo field's length to get lines required.
'
lngCharsWide = Int(Me.MyMemo.Width / 80)
lngRowsLong = Int(Len(Me.MyMemo) / lngCharsWide) + 1
Me.txtNumber = ""
For i = 1 To lngRowsLong
   Me.txtNumber = Me.txtNumber & CStr(i) & vbCrLf
   Next i

End Sub

Note: This only provides a rough estimate. It doesn't take into
account carriage returns (short lines) or the difference space requirements
for different letters like "i" and "w". It's pretty close though.

Wayne
 

Users who are viewing this thread

Back
Top Bottom