List Criteria

N

Nick hfrupn

I am trying to set up a query where the selection criterion comes from a
list. The list has records that contain wild cards eg.
NP-CS-PT1-CYSYS1-CP*-CHUTE*
NP-CS-PT1-CYSYS1-TPRP03-CHUTE*
NP-ST-CY6-CP*-CHUTE*
If I remove the wild cards eg NP-CS-PT1-CYSYS1-TPRP03-CHUTE or
NP-CS-PT1-CYSYS1, I get a result from the query. I need the query to be able
to recognise the wild card otherwise I would have to type in excessive number
of records for each list with the possibility of missing some.

Is there any way I can achieve this with the use of wild cards?
I have included the SQL from my query.

Regards
Nick


SELECT qyBacklog.FunctLocation, qyBacklog.Description, qyBacklog.Order,
qyBacklog.[Oper#/Act#], qyBacklog.[Order Type], qyBacklog.[Control key],
qyBacklog.[Work Center], qyBacklog.Description_wc, qyBacklog.[Planner group],
qyBacklog.Description_pg, qyBacklog.Res_Person, qyBacklog.[Opr# short text],
qyBacklog.[Normal duration], qyBacklog.Number, qyBacklog.Work,
qyBacklog.SystemCondition, qyBacklog.[Purch#req#], qyBacklog.[Earl#start
date], qyBacklog.Priority, qyBacklog.[System Status], qyBacklog.Equipment,
qyBacklog.Recipient, qyBacklog.[Std text key], [Forms]![Backlog
Selection2]!
  • AS List
    FROM [qyBacklog 1], qyBacklog
    WHERE (((qyBacklog.FunctLocation) In (SELECT [Floc] FROM [qyBacklog 1]))) OR
    ((([Forms]![Backlog Selection2]!
    • ) Is Null))
      ORDER BY qyBacklog.FunctLocation, qyBacklog.Order, qyBacklog.[Oper#/Act#];
 
M

Michel Walsh

Hi,


You should build the criteria keeping in mind you will use the operator
LIKE.

The easiest way (to me) to do that would be to make a table, one field, I
assumed its name is Location, and as many record as there are selected items
(one record per item) and the, to use an inner join like:


SELECT myTable.*
FROM myTable INNER JOIN myTempTable
ON myTable.Location LIKE myTempTable.Location & "*"


Use % instead of * if your setting requires it.



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top