Question Conditional format

Joe8915

Registered User.
Local time
Today, 14:50
Joined
Sep 9, 2002
Messages
820
Running MS 2010. A little stump here.
I have a field with numbers and in the same field I might have the word "final". Trying to figure out how I can have a conditional if the word "final" is found, highlite that field.

Any ideas
 
duh just figure it out............ use <> final
 
Joe,

After all those posts you have done I would have thought your question could have been a little more informative.

Like Version Windows
Version Access
Where is the field? In a Query or Table. There are no Fields in Forms or Reports.
 
Where is the field? In a Query or Table. There are no Fields in Forms or Reports.????

Maybe a little confused here. There are Fields in Forms and Reports

The field is in a form.


It maybe a case of terminology but there are no Fields in Forms or Reports. There are Controls which maybe Text Boxes and these Text Boxes display information that they get from Queries or Tables. Tables have Fields.

I can't think of a link to give you but I am sure if you Google you will find supporting documentation.
 
Rain, Sorry I was not more informative. I thought I had solved it, but I didn't explore it more.

The field is located on a form, which comes from a Table.

Still back to same problem. I have numbers in the field, and the field could contain the word final. If the word "final" shows up in the field, I would like the field display a some other color. I hope I didn't make that to confusing to understand.
 
How about an If Statement.

Code:
If me.txtFieldName = "final" Then
   Me.txtFieldName.ForeColor = 256
End If

Code NOT tested.
 
Rain, thanks for the quick reply.....I was thinking about that, but I could not make it work.

I placed the code in the "On Open" and tried the "On Enter" as well nothing happen.
 
I used this behind a Command Button.

My Names are different to yours so please change them.

Code:
Private Sub CmdTest_Click()
    If Me.txtDescription = "Trukeys" Then
        MsgBox "aaa"
        Me!txtDescription.ForeColor = 999
        MsgBox Me!txtDescription.ForeColor
    End If
    
    Me.Refresh
    
End Sub
 
Rain, its working only when in the textbox reads "Final", but if the textbox reads "12345 final" its not working, its kinda back to square one again.
 
Then you need to use "Like"

Check Access Help for the correct syntax.
 
Or you can also use the InStr function to check for the word "final", as it is a Text field.

General syntax :
Code:
Instr ( [start], string_being_searched, string2, [compare] )
in you case, might be..
Code:
If InStr(Me.txtDescription, "final")<>0 Then
 

Users who are viewing this thread

Back
Top Bottom