Solved

Access TextBox Bold Function

Posted on 2008-06-10
17
2,119 Views
Last Modified: 2013-11-28
Hi Expert,

I have a quick question.
I am seeking a function that can change words into bold format in a textbox.

for example,
="Today Date is " & Boldfunction(Date()) & "."

the output will be "Today Date is <b>06/10/2008</b>.

Thanks!
0
Comment
Question by:IEHP1
  • 7
  • 4
  • 3
  • +1
17 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 21752647
Function Bdate(mydate As Date)
Bdate = "<b>" & Format(mydate, "mm/dd/yyyy") & "</b>"
End Function
0
 

Author Comment

by:IEHP1
ID: 21753151
nope...

it does not work....
the <b> and </b> are just something like the html..
however, it does not work with access...
i put them there to make sure you understand the date will be bold.

Thanks!
0
 
LVL 77

Expert Comment

by:peter57r
ID: 21753906
That's not what I understood.  I thought you wanted to produce the html.

If you are trying to create a string which is actually  partly (or even ALL)  bold then you are out of luck in Access.
Variables and expressions have no formatting capability.  Formatting of that type is down to controls on forms and reports and their properties.  
There is no native Access control before A2007 which allows for mixed formats in a textbox, although there are third party rtf controls around.  





0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 28

Expert Comment

by:omgang
ID: 21753931
To do what you are asking will require two text boxes with no coding.  In Access forms/reports formatting applies to all text within the text box, i.e. you cannot bold only a portion of the text.  A solution is to use two text boxes.  The first contains ="Today Date is " as its control source and is right justified.  The second text box is adjacent to the first (right side) and has =Date() as its control source.  Set the Font Weight property to whatever you want (Bold) for this text box.

OM Gang
0
 

Author Comment

by:IEHP1
ID: 21754134
Peter57r: I just want to make sure. As you mentioned, it is not possible to write a function to do what i want?

OM Gang: Thanks! However, i am doing both Spanish and English version in the same report, the length of the test will not be the same. I cannot do two text boxes.

0
 
LVL 28

Expert Comment

by:omgang
ID: 21754288
That is why I said
<<The first contains ="Today Date is " as its control source and is right justified.>>

By making the text box right justified it doesn't matter how long the text is in the box.  It will always display as you want, i.e
        Today Date is |6/10/2008
      Hoy es la fecha|6/10/2008

OM Gang
0
 

Author Comment

by:IEHP1
ID: 21754503
OM Gang,

Actually, i made my question simplier to understand.

part of paragraph is
"Please return the enclosed application to qualify your child(ren) for up to one more year of health coverage by 06/30/2008"

and ths spanish version is
"Es hora de renovar el seguro médico Niños Saludables (Healthy Kids) de su(s) hijo(s). Por favor devuelva la solicitud adjunta para que su(s) hijo(s) tenga(n) acceso a un año más de cobertura médica de 06/30/2008"

the length of the whole paragraph in spanish and english are way different.
there is no way to do the adjustment using two textboxes.

0
 

Author Comment

by:IEHP1
ID: 21754529
sorry the spanish version is
"Por favor devuelva la solicitud adjunta para que su(s) hijo(s) tenga(n) acceso a un año más de cobertura médica de 06/30/2008"
0
 
LVL 28

Accepted Solution

by:
omgang earned 50 total points
ID: 21754587
Understood.  If you really want to have the date in bold then you're going to have to come up with a work around that allows you to use two text boxes, i.e.

"Please return the enclosed application to qualify your child(ren)
 for up to one more year of health coverage by the date specified."           <b>06/30/2008</b>

OM Gang
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21756456
IEHP1,

Go here and download the Rich Text Tool:
http://www.lebans.com/DownloadFiles/May23-2004OCXonly.zip
Install it.
Open Access.
Create a from.
Click: Insert ActiveX Control.
Find: RTF2 Control.
Drop 3 of them on your form, and re-size them so they will fit your text.
Insert these 3 text strings into the ControlSource Property of each RTF2 Control.

="{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard Es hora de renovar el seguro médico Niños Saludables (Healthy Kids) de su(s) hijo(s). Por favor devuelva la solicitud adjunta para que su(s) hijo(s) tenga(n) acceso a un año más de cobertura médica de {\b 06/30/2008.}\par}"

="{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard Please return the enclosed application to qualify your child(ren) for up to one more year of health coverage by {\b 06/30/2008.}\par}"

="{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard Por favor devuelva la solicitud adjunta para que su(s) hijo(s) tenga(n) acceso a un año más de cobertura médica de {\b 06/30/2008.}\par}"

I tried it and it works fine for me.
This should get you what you are looking for.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21757023
IEHP1,

In my above post I am using a Form.
But you can substitute a Report as well.

Do the above as a simple test to see if this is the effect you are after.

I can help you if any of the text needs to come from a table.

JeffCoachman
0
 

Author Comment

by:IEHP1
ID: 21764758
Hi Jeff

May i know if i have to install the Rich Text Tool on every computer that may run the report?

Thanks~
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21764918
Yes
0
 

Author Comment

by:IEHP1
ID: 21771722
because everyone in the company may run the report, is there anyway to do it within the database, but not every computers?

Thanks!
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 50 total points
ID: 21772855
IEHP1,

First, my assumption was that your DB is split.
(Font end DB on each users computer with Forms Queries and reports , and one Back end table with just the shared tables)

So AFAIK you have to literally "Install" it on each computer that needs it.

But just to be sure, see this as well:
http://www.lebans.com/richtext.htm#Older%20NON%20ActiveX%20solutions:


FMSinc also has a Rich Text control (Total Access Memo).
You will have to send them an email to see if the control can be "Database Specific"
http://www.fmsinc.com/products/memo/whydevelopers.html

JeffCoachman
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 50 total points
ID: 21776324
Any ocx or simlar used in the database must be installed on every user's machine.
0
 

Author Closing Comment

by:IEHP1
ID: 31465790
It is not the solution that i want.
I split the report into two - one english and one spanish.
So i dont have to worry about the length before the date.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question