Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a field based on other fields in a query

Status
Not open for further replies.

asp3232

Technical User
Jun 25, 2002
27
0
0
US
Hi,

I need to create a field in a query that will be a logical "OR" of other fields -- for example, if I have a table with the following structure:

Name
Issue1
Issue2
Issue3

I'd like a query that will return

Name
HasIssues

where HasIssues is True if any of the issues exists, False otherwise.

I don't want to have a field in my table for this, and I know this must be a simple solution, so I'd love some guidance or thoughts on how to do it.

Thanks!

asp
 
Set up the query grid with name,issue1,issue2,issue3. Set the criteria in the grid in the normal way and set issue fields not ot display. Then Add a fifth field to the query with this text: "HasIssue:-1", without the quote marks. When you run the query it will give you a list of nmaes meeting the criteria and -1 (which means yes in Access speak0 for each name. You could then use this as the basis for a further joined query.

Hope tihs helps
 
Select Name,
(Not Isnull(Issue1)) Or
(Not Isnull(Issue2)) Or
(Not Isnull(Issue3)) As HasIssues
From YourTable
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Thanks! That does what I was looking for!

asp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top