Im trying to perfom a search on the following criteria
- date of the event (in my access database) is BETWEEN a start and finish date
- a 'showthis?' type of value is set to YES
- (optionally) the detail/notes of the event matches a user-entered text string (using % as default though)...
Now, when I simplify the sql select statement (say just using the BETWEEN dates portion of the code) it works fine and finds only those matches.... when I make the select statemenet more complex though, it just returns ALL records.
I cant figure this out - what should i change? heres the select statement:
SELECT *
FROM tbl_events
WHERE showonsite Like 'MMColParam5' and (eventdate BETWEEN
#MMColParam2# AND #MMColParam3# And eventtitle like '%MMColParam4%' or eventdetail like '%MMColParam4%')
(in the recordset dialogue window I have the default values set like this
MMColParam 2 startdate (default value - 1/1/1989)
MMColParam 3 enddate (default value - 1/1/2008)
MMColParam5 Yes (default value set to YES)
MMColParam4 %
why is it choking with a more complex select statement? I added parenthesis after reading online that this would help with more complex statements.
- date of the event (in my access database) is BETWEEN a start and finish date
- a 'showthis?' type of value is set to YES
- (optionally) the detail/notes of the event matches a user-entered text string (using % as default though)...
Now, when I simplify the sql select statement (say just using the BETWEEN dates portion of the code) it works fine and finds only those matches.... when I make the select statemenet more complex though, it just returns ALL records.
I cant figure this out - what should i change? heres the select statement:
SELECT *
FROM tbl_events
WHERE showonsite Like 'MMColParam5' and (eventdate BETWEEN
#MMColParam2# AND #MMColParam3# And eventtitle like '%MMColParam4%' or eventdetail like '%MMColParam4%')
(in the recordset dialogue window I have the default values set like this
MMColParam 2 startdate (default value - 1/1/1989)
MMColParam 3 enddate (default value - 1/1/2008)
MMColParam5 Yes (default value set to YES)
MMColParam4 %
why is it choking with a more complex select statement? I added parenthesis after reading online that this would help with more complex statements.