tags:

views:

119

answers:

3

i am doing conditional formatting on a report in access

i need to check if a certain string exists in a field as the condition in conditional formatting. something like this:

[field_name] like '%something%'

will this kind of condition work?

+7  A: 

You have to use asterisk with MS Access.

[field_name] like '*something*'

For a single character, you can do this

[field_name] like 'fieldnam?'

For three characters, you can do this

[field_name] like 'fieldna???'
Raj More
...unless you're running Access in its so-called "SQL 92" mode, in which case the wildcards are the same as T-SQL, i.e., % and _.
David-W-Fenton
+1  A: 

Access uses the asterisk instead of the percent. Try

[field_name] like "*something*"
KevenDenen
+1  A: 

Yes, but it is a condition...

so you need something like

SELECT * FROM Foobar WHERE
[field_name] LIKE '*something*'
Joris
He's using this for conditional formatting, not as part of a full query. Ignore the SELECT * FROM Foobar WHERE part.
KevenDenen
ah, yes... my fault
Joris