Text Formatting based on criteria

  • Thread starter Thread starter Ian Bateman
  • Start date Start date
I

Ian Bateman

I have two fields in a record named [TextField] and
[BoldOn]. If the [BoldOn] field (which is a yes/no) is
checked then I want the [TextField] field to print bold,
otherwise normal.

Any ideas on how this can be achieved would be much
appreciated. I was able to do this 15 years ago in DOS
using Printer Commands, but that does now appear to work
with Access ... unless you know different :)

Many Thanks
Ian Bateman
 
Ian

I'll assume, since you posted in the 'reports' newsgroup, that your question
is about doing this in a report. Depending on the section in which this
pair of fields appears, you could use the OnFormat or OnPrint event to:
1. test the value of [BoldOn], and
2. set the .Bold property of the [TextField] field.

Good luck!

Jeff Boyce
<Access MVP>
 
Hi Jeff, thanks for your reply.

The [BoldOn] field will never appear on my Report. I
have created a text box on the Report in the Details
section that for the time being goes something like this:

Iif([BoldOn]=Yes,[TextField],[TextField])

The way I see it, something needs to be done with
the 'True' part of the argument to make the text box
print in bold and perhaps the 'False' part of the
argument to make the field print normal.

I have been messing about with the Chr$() Function to
send Printer Codes but that doesn't work like it used to
do in DOS. I think I understand what you are getting at -
I shall get back to you with the results of my efforts.

Thanks
Ian
 
Ian
Iif([BoldOn]=Yes,[TextField],[TextField])

This seems to say "display [TextField], no matter what". Is that what you
intended?
The way I see it, something needs to be done with
the 'True' part of the argument to make the text box
print in bold and perhaps the 'False' part of the
argument to make the field print normal.

Rather than trying to do formatting in the IIF() statement, do it in the
OnFormat or OnPrint event of the report itself (as suggested in earlier
response).
I have been messing about with the Chr$() Function to
send Printer Codes but that doesn't work like it used to
do in DOS. I think I understand what you are getting at -
I shall get back to you with the results of my efforts.

Thanks
Ian

You're not in Kansas anymore, Ian. I'd heard a scurrilous rumor that DOS
was dead. <g>

Good luck!

Jeff Boyce
<Access MVP>
 
No. I need to put something in the true part of the
argument eg Iif([BoldOn]=Yes,Chr(Print Bold)&
[TextField],Chr(Print Normal)&[Textfield])

I need to know what to put in the Chr bit, if indeed Chr
() is the way forward.

Thanks
Ian
-----Original Message-----
Ian
Iif([BoldOn]=Yes,[TextField],[TextField])

This seems to say "display [TextField], no matter what". Is that what you
intended?
The way I see it, something needs to be done with
the 'True' part of the argument to make the text box
print in bold and perhaps the 'False' part of the
argument to make the field print normal.

Rather than trying to do formatting in the IIF() statement, do it in the
OnFormat or OnPrint event of the report itself (as suggested in earlier
response).
I have been messing about with the Chr$() Function to
send Printer Codes but that doesn't work like it used to
do in DOS. I think I understand what you are getting at -
I shall get back to you with the results of my efforts.

Thanks
Ian

You're not in Kansas anymore, Ian. I'd heard a scurrilous rumor that DOS
was dead. <g>

Good luck!

Jeff Boyce
<Access MVP>

.
 
Back
Top