I would like to create a search function where people can type anything into the search field and it will bring up data that matches the search parameter.
So far I'm only able to have them search for parameters in a specific column with this code (created by Dreamweaver):
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_EventsDB_STRING
Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location, ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' ORDER BY Date_S ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
I don't see an option to have the search look through all columns instead of just one particular (bolded), something like this:
Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location, ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE IdMeeting, Date_S, EventName, Location, ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' ORDER BY Date_S ASC"
But this doesn't work. Maybe I should use brackets?
Recordset1.Source = "SELECT IdMeeting, Date_S, EventName, Location, ProjectLead, Status, TypeOfMeeting, MarketingLead, Industry FROM Meeting WHERE IdMeeting LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' OR Date_S 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 Industry LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' ORDER BY Date_S ASC"
However, you should know that the LIKE comparison only works on text fields. So, if Date_S is a date field then you would want to change:
Date_S LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%'
Bookmarks