examples:
tblMachine
MachineName testast
21A abcdef
21B abc****def
21C ****
21D *
21E
21F abc****def
//////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Like "[*]"
returns
MachineName testast
21D *
///////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Like "[****]"
returns
MachineName testast
21D *
//////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Like "[*][*][*][*]"
returns
MachineName testast
21C ****
//////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Not Like "[*][*][*][*]"
returns
MachineName testast
21A abcdef
21B abc****def
21D *
21F abc****def
[NOTE: did not return 21E which
does not have an "*" but is null]
//////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Not Like "[****]"
returns
MachineName testast
21A abcdef
21B abc****def
21C ****
21F abc****def
//////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Like "*[*]*"
returns
MachineName testast
21B abc****def
21C ****
21D *
21F abc****def
//////////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Not Like "*[*]*"
returns
MachineName testast
21A abcdef
[NOTE: did not return 21E which
does not have an "*" but is null]
/////////////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Like "*"
returns
MachineName testast
21A abcdef
21B abc****def
21C ****
21D *
21F abc****def
[NOTE: did not return 21E which
does not have an "*" but is null]
/////////////////////////////////////
SELECT
tblMachine.MachineName,
tblMachine.testast
FROM tblMachine
WHERE tblMachine.testast Not Like "*"
returns
MachineName testast
21E
[NOTE: returns only 21E which
does not have an "*" but is null]
///////////////////////////////////////
Gary Walter said:
WHERE [somefield] Not Like "*[*]*"
but this will also (as a side effect)
filter out all records where
[somefield] is null (if that matters).
Confusing I know, but inverse works "okay"
WHERE [somefield] Like "*[*]*"
will return ONLY records w/ any number
of "*" in [somefield]
Point being that "*" is a wildcard in Access
so theoretically you need to surround it with
brackets to search/filter for it.
"Gary Walter"wrote:
I have source data in a table for 4 different fields which is populated
with
data, but in some instances it is populated with 9 asterix's e.g.
*********
How can I put criteria in my query to filter these out..?
I have tried like "*********" and <>"*********"
also like ********* and Not like *********
but no luck so far - any suggestions would be greatly appreciated..
Hi Louise,
PMFBI
try
WHERE [somefield] Not Like "[*]"
Apologies again for butting in,
gary