subquery

L

lesle

I am trying to get a query to return specific records for a report - Multiple
records from same field.

I have used the code
SELECT assListFull.*
FROM assListFull
WHERE ((([Enter District numbers separated by space]) Like "*" & [Visitedby]
& "*"));

Which works okay to a point.

If I enter
1 3 15

I get
1 3 5 15

Is there a way I can get 'whole numbers' as opposed to part numbers

Lesle
 
A

Allen Browne

There is a rather clumsy way to do this:

PARAMETERS WotNum Text ( 255 );
SELECT tClient.ClientNum
FROM tClient
WHERE "," & Replace([WotNum], " ", "") & "," Like "*," & [ClientNum] & ",*";

The query pops up a parameter. You type the values separated by commas and
spaces.
 
M

Marshall Barton

lesle said:
I am trying to get a query to return specific records for a report - Multiple
records from same field.

I have used the code
SELECT assListFull.*
FROM assListFull
WHERE ((([Enter District numbers separated by space]) Like "*" & [Visitedby]
& "*"));

Which works okay to a point.

If I enter
1 3 15

I get
1 3 5 15


Change that to something more like:

WHERE " " & [Enter District numbers separated by space]
& " " Like "* " & [Visitedby] & " *"
 
L

lesle via AccessMonster.com

Brilliant, this worked exactly as I wanted, thanks so much

Lesle

Marshall said:
I am trying to get a query to return specific records for a report - Multiple
records from same field.
[quoted text clipped - 12 lines]
I get
1 3 5 15

Change that to something more like:

WHERE " " & [Enter District numbers separated by space]
& " " Like "* " & [Visitedby] & " *"
 
L

lesle via AccessMonster.com

Thanks for your help Allen, the other suggestion has worked

Lesle

Allen said:
There is a rather clumsy way to do this:

PARAMETERS WotNum Text ( 255 );
SELECT tClient.ClientNum
FROM tClient
WHERE "," & Replace([WotNum], " ", "") & "," Like "*," & [ClientNum] & ",*";

The query pops up a parameter. You type the values separated by commas and
spaces.
I am trying to get a query to return specific records for a report -
Multiple
[quoted text clipped - 18 lines]
 
M

Marshall Barton

Allen's suggestion was essentially the same thing. Mine
just didn't bother adding commas.
--
Marsh
MVP [MS Access]

Brilliant, this worked exactly as I wanted, thanks so much


Marshall said:
I am trying to get a query to return specific records for a report - Multiple
records from same field.
[quoted text clipped - 12 lines]
I get
1 3 5 15

Change that to something more like:

WHERE " " & [Enter District numbers separated by space]
& " " Like "* " & [Visitedby] & " *"
 
Top