How do I bold a certain word in the caption of a Microsoft Access label?
If it helps, the text itself is stored in a Microsoft Access table.
An example is below. I have a Microsoft Access form with a label, in the Form_Load()
event I set the caption property of this label to the value returned in a DLookup query like so:
Private Sub Form_Load()
Me.Label0.Caption = DLookup("Field1", "Table1", "[ID] = 1")
End Sub
My text is as follows:
The quick brown fox jumps over the lazy dog
I want to embolden the word Lazy. Is this possible? If so, how do I do this?
Thanks
To make any text bold in VBA, we can use the Font. Bold property of a Range or Cell.
Let's apply boldface formatting to the selected text labels. Click the Bold button on the Formatting toolbar. The selected controls appear in bold. Click the Save button to save your changes to the report.
You do not mention the version of Access, for 2007 (AFAIK) and 2010, you can create a textbox and set the Text Format on the data tab to Rich Text. You can then set the Control Source to:
="The quick <b>brown</b> fox"
Change a few more properties, such as Locked and Enabled and you will have a textbox that looks and acts like a label.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With