Filtering query with textbox and combo boxes (1 Viewer)

josephbupe

Registered User.
Local time
Today, 10:05
Joined
Jan 31, 2008
Messages
247
Hi,

I am creating a query that should filter records of events based on multiple fields. The filters should work with any combination of field criteria, but only two of the four field are working properly, as follows:

1. a text box for searching with event name (free text) - this is working;
2. a combo box to filter events by country name - this is working;
3. a combo box to filter events by event's keyword (category) - this is NOT working;
4. a combo box to filter events by year - this is NOT working

I believe I am doing the correct thing but it isn't working. Please, see attached copy of the database.

I will appreciate someone taking time to advise me on this problem.

Best regards.

Joseph




 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:05
Joined
Aug 30, 2003
Messages
36,125
If you look at the query in design view, note how the event criteria is on every line, but the others are not. Criteria on the same line are compared with AND, different lines with OR. You need to clarify your logic.

When I have multiple optional criteria like that, I tend to write dynamic SQL, like the sample db here:

http://www.baldyweb.com/BuildSQL.htm
 

josephbupe

Registered User.
Local time
Today, 10:05
Joined
Jan 31, 2008
Messages
247
If you look at the query in design view, note how the event criteria is on every line, but the others are not. Criteria on the same line are compared with AND, different lines with OR. You need to clarify your logic.

When I have multiple optional criteria like that, I tend to write dynamic SQL, like the sample db here:

http://www.baldyweb.com/BuildSQL.htm

Actually, the extra criteria line in query design were not my doing; it seems to be generated automatically and I was also wondering why.

I just wanted a simple way of filtering through the MS Access query and send the query to printer afterwards.

Thank you for helping out.

Joseph
 

Users who are viewing this thread

Top Bottom