Query Question - I don't know

  • Thread starter Thread starter Golfinray
  • Start date Start date
G

Golfinray

Is there a way in a query to have let's say three fields and do this:
If this field is not null OR if this field is not null OR if this field is
not null then do something? Is that possible? Thanks so much!!!!
 
Golfinray said:
Is there a way in a query to have let's say three fields and do this:
If this field is not null OR if this field is not null OR if this
field is not null then do something? Is that possible? Thanks so
much!!!!

It depends on what "doing something" means. It could very well be possible.
You are going to need to be more specific. It always helps to show us a few
rows of sample data, and then _show_ us what your desired results are.
 
Yes, if you know what to do in the negative. Note that I assume by "do
something" you mean compute something:



iif( (field1 IS NULL) AND (field2 IS NULL) AND (field3 IS NULL), NULL,
computeSomething( ) )


where computeSomething( ) can be a public user defined function, returning
some value, in a standard module, but which can do something else too, as
side effect, such as sending you an email. I assumed that in the negative,
the result to return is NULL.



Vanderghast, Access MVP
 
I didn't explain very well, sorry. I have fields of numbers and I would like
to return records only if any one or all of the 3 fields is null. So if any
or all of the 3 fields in that record is null, I want to return that with the
query. That information will go on a report. Then I know that one or more of
them are missing. Thanks again!!!
 
In the SQL view, have something like:

SELECT *
FROM myTable
WHERE (field1 IS NULL) OR (field2 IS NULL) OR (field3 IS NULL)



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

Back
Top