I have a script that works and returns results if the date selected is "Before" or "After" but if I select "ON" I always get no results when I should be.

This is the search code:

Code:
Scheduled: 
        <select style="display:inline" name="period" id="period">
        <option value="">Select Period</option>
          <option value="ON">ON</option>
          <option value="BEFORE">BEFORE</option>
          <option value="AFTER">AFTER</option>
          </select>
          <select style="display:inline" name="pday" id="pday">
        <%
		for i = 1 to 31
		%>
          <option value="<%=i%>" 
          <%
		  if day(date) = i then
		  response.write "selected"
		  end if
		  %>><%=i%></option>
        <%
		next
		%>
            </select>
            <select style="display:inline" name="pmonth" id="pmonth">
        <%
		for i = 1 to 12
		%>
          <option value="<%=i%>"
          <%
		  if month(date) = i then
		  response.write "selected"
		  end if
		  %>
          ><%=left(monthname(i),3)%></option>
        <%
		next
		%>
        </select>
        <select style="display:inline" name="pyear" id="pyear">
    <%
		for i = 2005 to 2025
		%>
          <option value="<%=i%>"
          <%
		  if year(date) = i then
		  response.write "selected"
		  end if
		  %>
          ><%=i%></option>
        <%
		next
		%>
    </select>
The following gives me results for 'period=after' or 'period=before' except if 'period=ON' for some reason, when there should be results.


Code:
	if period <> "" then
		if period = "ON" then
		SQL7 = " AND date_of_exam = #" & pday & "-" & pmonth & "-" & pyear & "#"
		end if
		if period = "BEFORE" then
		SQL7 = " AND date_of_exam < #" & pday & "-" & pmonth & "-" & pyear & "#"
		end if
		if period = "AFTER" then
		SQL7 = " AND date_of_exam > #" & pday & "-" & pmonth & "-" & pyear & "#"
		end if
	end if
Now, the date_of_exam is stored in Access as a General date so not sure if ON is looking to the minute? Any ideas?