Using wildcard in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report with a text box that lists errors. The last word ends in
either CRITICAL or MAJOR. I want to highlight the error in red if it is a
CRITICAL error. I tried to use a wild card IE

IF [TPC error]= Like "*CRITICAL" then [TPC_box] visiable = true

This does not work please help
 
SSgt Jim said:
I have a report with a text box that lists errors. The last word ends in
either CRITICAL or MAJOR. I want to highlight the error in red if it is a
CRITICAL error. I tried to use a wild card IE

IF [TPC error]= Like "*CRITICAL" then [TPC_box] visiable = true


IF [TPC error] Like "*CRITICAL" then
[TPC_box].ForeColor= vbRed
Else
[TPC_box].ForeColor= vbBlack
End If
 
Well I have another problem. The TPC error box is a combo box. I can get the
forcolor to work if I use numbers however there are aprox 250 - 300 differant
TPC errors that are critical errors and we add more every day. I can not keep
adding to the code everytime we add a error. I realy need the Like"*CRITICAL"
to work. thanks in advance

Marshall Barton said:
SSgt Jim said:
I have a report with a text box that lists errors. The last word ends in
either CRITICAL or MAJOR. I want to highlight the error in red if it is a
CRITICAL error. I tried to use a wild card IE

IF [TPC error]= Like "*CRITICAL" then [TPC_box] visiable = true


IF [TPC error] Like "*CRITICAL" then
[TPC_box].ForeColor= vbRed
Else
[TPC_box].ForeColor= vbBlack
End If
 
SSgt said:
Well I have another problem. The TPC error box is a combo box. I can get the
forcolor to work if I use numbers however there are aprox 250 - 300 differant
TPC errors that are critical errors and we add more every day. I can not keep
adding to the code everytime we add a error. I realy need the Like"*CRITICAL"
to work. thanks in advance

Not knowing any details about your combo box, I can't really
say. Are you sure you're using a combo box on a report??
That's a very unusual thing to do.

Maybe you should also explain where this code is being
executed.
--
Marsh
MVP [MS Access]


SSgt Jim said:
I have a report with a text box that lists errors. The last word ends in
either CRITICAL or MAJOR. I want to highlight the error in red if it is a
CRITICAL error. I tried to use a wild card IE

IF [TPC error]= Like "*CRITICAL" then [TPC_box] visiable = true
Marshall Barton said:
IF [TPC error] Like "*CRITICAL" then
[TPC_box].ForeColor= vbRed
Else
[TPC_box].ForeColor= vbBlack
End If
 
Back
Top