Text Box

EmmaJane

Registered User.
Local time
Today, 23:22
Joined
Nov 5, 2003
Messages
214
Hi all

Hope you can help with this one. We have linked tables to a separate database that holds all our clients, I have no control over the set up of this system. There is one field in here that the staff uses to record notes about particular clients. What they would now like to do is print these off at regular intervals. Not usually a problem, however not all clients will have notes. The problem I am having is that every field has formatting it in whether is has notes or not, I have managed to extract just the clients I want by using a criteria of like “*/04*” as they should all have a date entered. What I now need to do is put this in a report. However it is appearing as below and I would just like to text I have highlighted in red. They should start with a date (not a date field) and end in the users initials.

Any help would be greatly appreciated.

PRIVATE_NOTES
{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss MS Sans Serif;}}{\colortbl\red0\green0\blue0;}\deflang2057\pard\plain\f2\fs17 Nornal Services over xmas and new year pp\par \par 2/2/04 - denise called to say client is bleeding gp will be calling in to see her. - ps\par 4/2/04- denise called to say gp has been, she has a prolapsed bowel, he will refer her to the hosp for further investigation - ps\par }
 
This looks like rich text format (RTF). have you tried using a rtf text box on your report instead of a regular txt box?
 
okay, can you tell me how I would do that ?? :)
 
EmmaJane said:
okay, can you tell me how I would do that ?? :)
Use the same control type on the report as on the form. If they are using an access form to input this, then you must already have the RTF textbox referanced in the app.
 
The original form is in another system altogether and I have no control over this at all, the tables are linked into access from which I can create various reports. :(
 
Step By Step Solution:

1. Open a new form
2. Insert a Rich Text ActiveX and name it "RichText"
3. Insert a Common Dialog Box ActiveX and name it "CommonDialog1"
4. Save the new form and name it "TestForm"
5. Open the form code module for "TestForm" and insert the following code.
===================================
Private Sub RichText_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal Y As Long)
If Button = acRightButton Then
Call rtPrint
End If
End Sub

Public Function rtPrint()

'Use this code to print.

Dim saveSelStart As Long, saveSelLength As Long

On Error Resume Next
With CommonDialog1
.CancelError = True
.flags = cdlPDHidePrintToFile Or cdlPDNoPageNums Or cdlPDReturnDC
If RichText.SelLength = 0 Then
' if no text is select, disable the option on the dialog
.flags = .flags Or cdlPDNoSelection
Else
' otherwise make "Selection" the default choice
.flags = .flags Or cdlPDSelection
End If
.ShowPrinter
If Err = 0 Then
If .flags And cdlPDSelection Then
' User decided to print the current selection,
RichText.SelPrint .hdc
Else
' User decided to print the entire contents, so select it
saveSelStart = RichText.SelStart
saveSelLength = RichText.SelLength
RichText.SelStart = 0
RichText.SelLength = 999999
' Print on the device context returned by the common dialog
RichText.SelPrint .hdc
' Restore old selection
RichText.SelStart = saveSelStart
RichText.SelLength = saveSelLength
End If
End If
End With
End Function
===================================
6. Close the form code module for "TestForm"
7. Close Design View and the open "TestForm"
8. Enter text into the Rich Text field on the form.
9. Right click to open print dialog
10. Click on OK to print.
11. Voila
 

Users who are viewing this thread

Back
Top Bottom