Click to See Complete Forum and Search --> : Past Dates still showing


Illufox
03-24-2005, 12:08 PM
I have a calendar page which displays only current dates, no past dates and contains a search field where people can search for any field in the database. Wile the calendar doesn't display any past dates, the search result page does. I need to get rid of this but when I use the same code piece ("Date_S >= Date()") I used for the calendar page it doesn't work. Here is what I have:

Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location, ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry, ADDStaff FROM Meeting
WHERE Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR EventName LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR Location LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR ProjectLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR Status LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR MarketingLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
OR ADDStaff LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
AND Date_S >= Date()
ORDER BY Date_S ASC"

The page seems to completely ignore this piece of code (bold) although it works just fine in the calendar page. What am I doing wrong?

russell_g_1
03-24-2005, 04:18 PM
that's because you need brackets around the whole bunch of ORs.

lmf232s
03-24-2005, 04:33 PM
russell_g is correct you need () around the or but befor the and
so like this i do believe

" SELECT IdMeeting, " & _
" Date_S, " & _
" EventName, " & _
" Location, " & _
" ProjectLead, " & _
" Status, " & _
" TypeOfMeeting, " & _
" MarketingLead, " & _
" Industry, " & _
" ADDStaff " & _
" FROM Meeting " & _
" WHERE (Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR EventName LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR Location LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR ProjectLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR Status LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR MarketingLead LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR TypeOfMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' " & _
" OR ADDStaff LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%') " & _
" AND Date_S >= Date() " & _
" ORDER BY Date_S ASC "


Here is an example that is simpler

SELECT * FROM Persons WHERE
(FirstName='Tove' OR FirstName='Stephen')
AND LastName='Svendson'

Illufox
03-24-2005, 07:16 PM
Thanks, it works! :)

I knew it must be something simple, just couldn't figure it out myself!