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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble with query

Status
Not open for further replies.

hiya5150

Technical User
Feb 22, 2004
19
US
i'm trying to create the following query:

from donation records i want all those records that have t05 in the donation type but not those that have '2005' in the memo field. now, if i type 'not like 2005' in the criteria for memo and t05 for the donation type field, i only get those fields that have something in the memo field, something other than 2005. in other words, i'm not getting the records with null value in the memo field. i've tried several things, but i can't make it work. please help!
 
Change your memo criteria to:

Not Like "*2005*" Or Is Null

hope this helps
 
Nest your if's:
if type = "t05" then
if memo not "2005" then
etc
This way you'll select all the t05 records first then you can sort out the memo 2005 records.

Cathy
 
WHERE Nz([memo field]) Not Like '*2005*' AND [donation type]='t05'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
i've tried all of your suggestions(before i posted my message). the problem is that if i put in 'not in 2005' and is null, it filters all the records that have something other than 2005 in memo.


as for mzkitty's suggestions, i'm not so familiar with slq, perhaps you can write it out, i'm not sure where to put my ifs. thanks.
 
anyway, since i didn't want to try the 'if' idea, i would have to dig up my access book for that, i figured out another way. i typed NOT LIKE '2005' OR IS NULL. it's the only way i could make it work.

thanks everyone. Heidi.
 
you're right. in hindsight, i realized that i entered not like 2005 on one line and is null and the other line. which seems to be why it excluded all the other records that fit the 'is null' criteria.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top