Question Multi criteria query (1 Viewer)

goophibama

New member
Local time
Today, 14:48
Joined
Jul 12, 2019
Messages
2
I was hoping someone could help me with an issue I'm having with a query and hopefully, I can do a decent job of explaining what I'm wanting.

I have a database of business licenses that I am building and I need a query that will return an activity type but only for businesses that are licensed this year. So for instance, you might want to check to get a list of bowling alleys that have an active license, but the user can put in a partial string and it will find matches, but again, only for those with a date falling within this year. I've tried every combination that I can think of, but I can't get this to work. Does anyone have any suggestions? It's been about 15 years since I've used Access, so what I used to know (which admittedly wasn't much) is pretty much gone and I am having to self-teach from scratch. Thanks in advance, this one has been driving me crazy.

Access Capture.GIF
 

plog

Banishment Pending
Local time
Today, 16:48
Joined
May 11, 2011
Messages
11,612
Couple things:

1. You have criteria on two different lines, this means you are not using them together (AND) but seperately (OR). Your query returns results that passes just 1 of your criterion. To work together, you need both criterion on the same line--move the date criterion up a line.

2. Change your date field to one that just obtains the year:

YearActive: Year([YourFieldNameHere])

Then for the criteria use the current year:

=Year(Date())

That should do what you want.
 

Micron

AWF VIP
Local time
Today, 17:48
Joined
Oct 20, 2018
Messages
3,476
get rid of the "and" for starters because that is putting the literal word 'and' as part of your date field criteria. Then there is the fact that you have each critieria on separate rows, which means "gimme based on this" OR "gimme based on that". If on the same row, it is an AND situation. Your post reads like you want "and", so on one row. You could try either way.
 
Last edited:

goophibama

New member
Local time
Today, 14:48
Joined
Jul 12, 2019
Messages
2
Thanks for the help. I moved it to the same line, then keyed off of another field (business license year) and made the change and it worked. Why I didn't key off of the business license year field in the first place is beyond me. Thanks for your help, I really appreciate it!
 

Micron

AWF VIP
Local time
Today, 17:48
Joined
Oct 20, 2018
Messages
3,476
NP. Good luck, and thanks for the reputation boost.
 

Users who are viewing this thread

Top Bottom