Variable button caption format?

  • Thread starter Thread starter PayeDoc
  • Start date Start date
P

PayeDoc

Hello All

Is it possible to set a button's caption with variable format, with code ?
e.g.
MyButton.caption = "Process for "&[forms]![frm_main]![client-name] & " for
the month of "& [forms]![frm_main]![month-name]

This works, but it would be great if I could get the
[forms]![frm_main]![client-name] and [forms]![frm_main]![client-name] parts
of the caption to show in larger, bold lettering.

Thanks for any help.
Les
 
On Fri, 24 Jul 2009 14:33:17 +0100, "PayeDoc"

No, there is only one font for a button. In your case an Image would
not help either.

-Tom.
Microsoft Access MVP
 
Yes, you can do it programmatically. VBA Help will give you values for the
font weight. For font names, use the actual name of a font. for font size,
use the actual point value. You can also change the color. Here is an
example

With Me.MyCommandButton
.fontname = "courier"
.fontsize = 16
.fontweight = 700 'Make it Bold
.forecolor = vbred
End With
 
Hello Dave

Thanks for your reply, but I think you may have missed that I was asking if
it is possible to specify VARIABLE formats for different parts of the
caption - so that part of the caption is, say. bold, and part of it is, say
underlined, etc etc.

Tom reckons not: unless you know of any 'workaround'?

Thanks again
Les



Klatuu said:
Yes, you can do it programmatically. VBA Help will give you values for the
font weight. For font names, use the actual name of a font. for font size,
use the actual point value. You can also change the color. Here is an
example

With Me.MyCommandButton
.fontname = "courier"
.fontsize = 16
.fontweight = 700 'Make it Bold
.forecolor = vbred
End With


--
Dave Hargis, Microsoft Access MVP


PayeDoc said:
Hello All

Is it possible to set a button's caption with variable format, with code ?
e.g.
MyButton.caption = "Process for "&[forms]![frm_main]![client-name] & " for
the month of "& [forms]![frm_main]![month-name]

This works, but it would be great if I could get the
[forms]![frm_main]![client-name] and [forms]![frm_main]![client-name] parts
of the caption to show in larger, bold lettering.

Thanks for any help.
Les
 
Tom

Many thanks for your reply
Oh well - it was worth a try!

Les



Tom van Stiphout said:
On Fri, 24 Jul 2009 14:33:17 +0100, "PayeDoc"

No, there is only one font for a button. In your case an Image would
not help either.

-Tom.
Microsoft Access MVP

Hello All

Is it possible to set a button's caption with variable format, with code ?
e.g.
MyButton.caption = "Process for "&[forms]![frm_main]![client-name] & " for
the month of "& [forms]![frm_main]![month-name]

This works, but it would be great if I could get the
[forms]![frm_main]![client-name] and [forms]![frm_main]![client-name]
parts
of the caption to show in larger, bold lettering.

Thanks for any help.
Les
 
Back
Top