change font size

M

mcnews

how can i change font size in a text box based on content? say if
txtWell1.Text = "POSITIVE CONTROL" for example?

tia,
mcnewsxp
 
M

mcnewsxp

Dim ctl As Control
For Each ctl In Me.Controls
If (ctl.ControlType = acTextBox) Then
If InStr(ctl.Value, "CONTROL") > 0 Then
ctl.FontSize = 10
End If
Next ctl
 
F

fredg

how can i change font size in a text box based on content? say if
txtWell1.Text = "POSITIVE CONTROL" for example?

tia,
mcnewsxp

Code the Format event of whatever section of the report the control is
placed in, i.e. Detail Format event:

If Me.[txtWell1] = "POSITIVE CONTROL" then
Me.[txtWell1].Fontsize = 14
Else
Me.[txtWell1].Fontsize = 10
End If

Note: In Access it's the Value property, not the Text property, that
you need to check. As Value is the default property, there is no need
to expressly write 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