If then Else is not workint to set a field as bold

M

Marco

Hi,

I put the following comand in forms load property to set some bolds and is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
M

Mark A. Sam

Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam
 
M

Marco

Hi.

it doesn't work. :(

Any ideas?



Marco




Mark A. Sam said:
Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Marco said:
Hi,

I put the following comand in forms load property to set some bolds and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
M

Mark A. Sam

What version of Access? Post your revision.


Marco said:
Hi.

it doesn't work. :(

Any ideas?



Marco




Mark A. Sam said:
Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Marco said:
Hi,

I put the following comand in forms load property to set some bolds
and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
M

Mark A. Sam

Check the value of [CodigoRubrica] using a Msgbox to make sure that it =
"TOTAL"

If Me.CodigoRubrica = "TOTAL" Then
MsgBox [CodigoRubrica]
Me.SumOfMes1.FontBold = 6
End If


Marco said:
Hi.

it doesn't work. :(

Any ideas?



Marco




Mark A. Sam said:
Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Marco said:
Hi,

I put the following comand in forms load property to set some bolds
and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
B

BruceM

Since it is a datasheet you can use Conditional Formatting to accomplish
what you need. Click into SumOfMes1 in datasheet view (not design view),
then click Format > Conditional Formatting. Select "Expression is", and in
the box to the right of that selection put:
[CodigoRubrica]="TOTAL"
Select the icon for bold font.

There are some techniques for more complex formatting using code (changing
the row color, for instance) in a continuous form (I'm not sure about
datasheet view, but you can format a continuous form to look like a
datasheet), but it sounds as if Conditional Formatting, which is simpler to
implement, will do what you need.

Note that you would need to use the same technique for a Continuous form.
You can use code as you have done in a Single form, although the Load event
is not a good choice. Even if it works at all it will not alter the result
from record to record; the initial formatting will apply to all records.
Try the Current event. Also, it is best if you give the text box a
different name than the field, if it is not already.

Note also that if you are using code you need to set FontBold to False if it
fails the logical test, or else it will remain bold once it has been
formatted that way:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
Else
Me.SumOfMes1.FontBold = False
End If

Marco said:
Hi.

it doesn't work. :(

Any ideas?



Marco




Mark A. Sam said:
Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Marco said:
Hi,

I put the following comand in forms load property to set some bolds
and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
M

Marco

Hello.

i have access 2003 and i try as you said and returns no message.

it only works if I put on current. do you this is because I'm using the
datasheet view?


Marco




Mark A. Sam said:
Check the value of [CodigoRubrica] using a Msgbox to make sure that it =
"TOTAL"

If Me.CodigoRubrica = "TOTAL" Then
MsgBox [CodigoRubrica]
Me.SumOfMes1.FontBold = 6
End If


Marco said:
Hi.

it doesn't work. :(

Any ideas?



Marco




Mark A. Sam said:
Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Hi,

I put the following comand in forms load property to set some bolds
and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
M

Mark A. Sam

I'm sorry, I missed from the first post that you were trying to set the bold
property from the forms Load event. The proper place to do this is the
Current event, however, the Bold property is either on or off for all
records. If you are attempting to display bold on some records and not
others, this won't happen.



Marco said:
Hello.

i have access 2003 and i try as you said and returns no message.

it only works if I put on current. do you this is because I'm using the
datasheet view?


Marco




Mark A. Sam said:
Check the value of [CodigoRubrica] using a Msgbox to make sure that it =
"TOTAL"

If Me.CodigoRubrica = "TOTAL" Then
MsgBox [CodigoRubrica]
Me.SumOfMes1.FontBold = 6
End If


Marco said:
Hi.

it doesn't work. :(

Any ideas?



Marco




:

Use a number from 0-8 to designate the Font Weight like:

[SumOfMes1].FontBold = 6

God Bless,

Mark A. Sam

Hi,

I put the following comand in forms load property to set some bolds
and
is
not working:

If Me.CodigoRubrica = "TOTAL" Then
Me.SumOfMes1.FontBold = True
End If


This form as a datasheet view, view.

Can you help??

regards,
Marco
 
L

Linq Adams via AccessMonster.com

"Click into SumOfMes1 in datasheet view (not design view)"

Bruce: Why do you think this can't be done in Design View?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
B

BruceM

I was trying to say that the design view doesn't look like the datasheet
view, even when the Default View is Datasheet, and that it can be done in
datasheet view, but I managed to mangle it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top