Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Fomatting a text box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jayashree Krishna - 05 Nov 2006 02:46 GMT
Hi,

Is there a way to show some part of the text as highlighted or bold in a
text box thru VBA code?

Thanks for your help
Krishna
Duane Hookom - 05 Nov 2006 02:54 GMT
You might need to use a Rich Text control. If you are attempting to do this
in a report then you can use the Print method of the report in the On Format
event. For instance if you were reporting the Customer table from Northwind
and wanted to concatenate the CustomerID and CompanyName with the first part
bolded you could use the following code in the On Format event of the
section containing the text. NOTE: the CustomerID and CompanyName would need
to be bound to controls in that report section. The controls could/should be
invisilbe.

My code also assume you add an invisible line named "LineTop" where you want
the text to appear.

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

   Dim intSpacing As Integer
   intSpacing = 60 'space between fields
   Me.CurrentX = Me.LineTop.Left
   Me.CurrentY = Me.LineTop.Top
   Me.FontSize = 10
   Me.FontBold = True
   Me.Print Me.CustomerID  'must be bound control
   Me.FontBold = False
   Me.CurrentY = Me.LineTop.Top
   Me.CurrentX = Me.CurrentX + intSpacing
   Me.Print Me.CompanyName  'must be bound control
End Sub

Signature

Duane Hookom
MS Access MVP

> Hi,
>
[quoted text clipped - 3 lines]
> Thanks for your help
> Krishna
Jayashree Krishna - 05 Nov 2006 03:13 GMT
Thank you . I use the code for reporting.

Thanks
Krishna

> You might need to use a Rich Text control. If you are attempting to do this
> in a report then you can use the Print method of the report in the On Format
[quoted text clipped - 30 lines]
> > Thanks for your help
> > Krishna
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.