How do I eliminate data in my query?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to run a query that does not show certain account types, for example
M, D, 1, DS, DV, S, X... I keep getting an error that my string is too long.
 
Build a table named Opt_out with a field named Opt_out containing all the
items you do not want. If this list will be used many times and change a lot
then add a Yes/No field named Out.

Create your select query and left join your data to the Opt_out field of the
Opt_out table.

If a one-time shot pull down the Opt_out field and use Is Not Null as
criteria.

If going for the multiple use of the Opt_out table pull down the field named
Out and criteria of -1 (minus 1).

This way you can edit the Out field each time but keep your list.
 
Donna:

Is the list of account types arbitrary or determined by some common
attribute? If the latter then you should have a column in an AccountTypes
table to hold the attribute values, or if each account can have multiple
attributes in another table related to the AccountTypes table via a table
modelling the many-to-many relationship. The query could then be restricted
on the value of the attribute in question.

With limited information you've provided its difficult to be more
categorical, but if you could post back with a description of the business
model in terms of the real world entities rather than the tables it would
probably be possible to give more specific advice.

If the list of desired exclusions is arbitrary then this could probably be
done by means of a NOT IN(<value list>) operation. The IN operator does not
allow parameters as its value list, only literal values, but you'll find
means of simulating it while using parameters at:


http://support.microsoft.com/kb/100131/en-us


Ken Sheridan
Stafford, England
 
Back
Top