Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access TextBox Bold Function

Posted on 2008-06-10
17
Medium Priority
?
2,473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 150 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 150 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 150 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

721 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