Note that there are some explanatory texts on larger screens.

plurals
  1. POnull parameter between two dates in access 2007
    primarykey
    data
    text
    <p>I have a query as below :</p> <pre><code>select column_date, field1, field2, sum(field3) from table1 where field1 like '*xyz' and column_date between [please enter start date] and [please enter end date] group by column_date, field1, field2 </code></pre> <p>When I leave blank both the parameter boxes, the output is blank. But I want them in output as below</p> <ol> <li>I want to display all records when I leave blank both parameter box </li> <li>if I put date in any one of the parameter boxes, it should display only records for that date </li> <li>If i put dates in both the parameter boxes, it should display all records between those dates.</li> </ol> <p>This is my asp code to display the output. It works when I insert values in both the text boxes but if I left blanks any of them or both, it shows error.</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;% dim startdate, enddate startdate = Request.Form ("startdate") enddate = Request.Form("enddate") set conn = Server.CreateObject ("ADODB.Connection") conn.open "connectionname" set rs = Server.CreateObject ("ADODB.Recordset") Sqlquery = "queryname '" &amp; startdate &amp; "', '" &amp; enddate &amp;'" " rs.open sql, conn %&gt; &lt;table&gt; &lt;tr&gt; &lt;% For each x in rs.fields response.write ("&lt;th&gt;" &amp; x.name &amp; "&lt;/th&gt;") next %&gt; &lt;/tr&gt; &lt;tr&gt;&lt;% Do Until rs.EOF %&gt; &lt;% For each x in rs.Fields %&gt; &lt;td&gt;Response.write (x.value)&lt;/td&gt; &lt;%next rs.movenext %&gt; &lt;/tr&gt; &lt;% loop rs.close conn.close %&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload