The following example demonstrates the procedure for making
the
firstname field in the text box bold while keeping the
lastname field normal in a report.
- Copy Microsoft Rich TextBox ActiveX Control (the
Richtx32.ocx file) to the C:\Windows\System folder. Make sure that you copy
version 6.0.88.4 or later of the Richtx32.ocx file.
Version 6.0.88.4 or later of the Richtx32.ocx file comes with Microsoft Visual Studio 6.0 Service Pack 4 (SP4) or later. If you do not have the appropriate version, you can download Visual Studio 6.0 SP5 from the following Web site, and then run the update to obtain the correct version of the file:
Note that to be able to run the update, you must have at least
one of the Visual Studio programs installed on your computer. Also, there is a
problem with the Rich TextBox Control.
For additional information, click the
article number below to view the article in the Microsoft Knowledge Base:
212733�
FIX: Contents of Rich TextBox Control Not Viewable in Report
- Register the Rich TextBox Control by using the Regsvr32.exe
program:
- Click Start, and then click Run.
- In the Open box, type the following command, and then press ENTER:
Regsvr32 C:\Windows\System\Richtx32.ocx
- Create a concatenated field in a query that contains first
and last names from the Employees table:
- In the Database window in Access 2000, click Queries under Objects, and then click New.
- In the New Query dialog box, click Design View, and then click OK.
- In the Show Table dialog box, click the Employees table on the Tables tab, click Add, and then click Close.
- In the Field box in the query design grid, type the following:
concatenate: [firstname] & " " & [lastname]
- On the File menu, click Save, type a name for the query, and then click OK.
- Create a report that is based on the query and that uses
the Rich TextBox ActiveX Control:
- In the Database window, click Reports under Objects, and then click New.
- In the New Report dialog box, click Design View, click the newly created query in the Choose the table or query where the object's data comes from box, and then click OK.
- On the Insert menu, click ActiveX Control.
- In the Select ActiveX Control dialog box, click Microsoft Rich TextBox Control 6.0 (SP4), and then click OK.
- Right-click the inserted Rich TextBox control, and then
click Properties.
- On the Data tab, make sure that concatenate is listed in the
Control Source box.
- Right-click the Detail section on the report, and then click Build Event.
- In the Choose Builder dialog box, click Code Builder, and then click OK.
- Under the Detail_Format event, type the following code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim theFirstName As String
Dim theLastName As String
theFirstName = Left(Me.concatenate.Value, InStr(1, Me.concatenate.Value, " "))
theLastName = Mid(Me.concatenate.Value, InStr(1, Me.concatenate.Value, " ") +1)
With ActiveXCtl15
'You need to replace ActiveXCt115 with the name of the Rich TextBox
'control that you inserted.
.SelBold = True
.SelText = theFirstName
.SelBold = False
.SelText = theLastName
End With
End Sub
- Preview the report.
Note that Print Preview may be blank on the ActiveX control.
However, you can print the report to view the results.
For additional information, click the
article number below to view the article in the Microsoft Knowledge Base:
212733�
FIX: Contents of Rich TextBox Control Not Viewable in Report