Certain Dates

  • Thread starter Thread starter MasterChief
  • Start date Start date
M

MasterChief

I have a database called MaterialEstimating and I have created all the
pages like edit, delete and new using the Database Wizard in Frontpage
2003. Now the users want a page that reports records that have a DateIN
between the days they specify. I created a simple page and put two
boxes in a form called StartDate and EndDate. Is there a simple way of
pressing OK and having the ASP just give records for the dates
specified in DateIN?
 
Yes, create a query page using the Database Results Wizard; with a custom
query that looks something like this:

s-sql="SELECT * FROM issues WHERE (issueDate > #::StartDate::# AND
issueDate < #::EndDate::#)"

--

~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web: http://www.spiderwebwoman.com/resources/
 
or for the WHERE clause use

WHERE (issueDate BETWEEN #::StartDate::# AND #::Enddate::#)

...PC
 
I think I am very close to the answer but I am still having a problem.
I am using the POST method of a Form to send the StartDate and EndDate
to another page that tries to print out the Data. The first page is a
basic form that posts to the new page. But when the new page comes up
it can't query anything because the Dates aren't coming into the sSQL
statement. They are actually showing up as #::strStartDate::# for
example. Here is my code for the report page

dim strStartDate
dim strEndDate

strStartDate = Request.QueryString("StartDate")
strEndDate = Request.QueryString("EndDate")
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.RecordSet")
Conn.Open "MaterialEstimating"
sSQL = "SELECT * FROM LogSheet WHERE (DateIN >= #::strStartDate::# AND
DateIN <= #::strEndDate::#)"
Set Rs = Conn.Execute(sSQL)
Do While NOT Rs.EOF
 
Change

strStartDate = Request.QueryString("StartDate")
strEndDate = Request.QueryString("EndDate")

To

strStartDate = Request.Form("StartDate")
strEndDate = Request.Form("EndDate")
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
And then change the sSQL to separate your variables from your string text

sSQL = "SELECT * FROM LogSheet WHERE " & _
"(DateIN >= #" & strStartDate & _
"# AND DateIN <= #" & strEndDate & "#)"

And if you are getting the dates from a user form entry using

strStartDate = Request.Form("StartDate")
strEndDate = Request.Form("EndDate")

Make sure you really have a valid date for each date or the code will generate an error

If Not IsDate(strStartDate) OR Not IsDate(strEndDate) Then
' send them back to the form for valid date entries
End If

--




| Change
|
| strStartDate = Request.QueryString("StartDate")
| strEndDate = Request.QueryString("EndDate")
|
| To
|
| strStartDate = Request.Form("StartDate")
| strEndDate = Request.Form("EndDate")
| --
| ==============================================
| Thomas A. Rowe (Microsoft MVP - FrontPage)
| ==============================================
| If you feel your current issue is a results of installing
| a Service Pack or security update, please contact
| Microsoft Product Support Services:
| http://support.microsoft.com
| If the problem can be shown to have been caused by a
| security update, then there is usually no charge for the call.
| ==============================================
|
| | >I think I am very close to the answer but I am still having a problem.
| > I am using the POST method of a Form to send the StartDate and EndDate
| > to another page that tries to print out the Data. The first page is a
| > basic form that posts to the new page. But when the new page comes up
| > it can't query anything because the Dates aren't coming into the sSQL
| > statement. They are actually showing up as #::strStartDate::# for
| > example. Here is my code for the report page
| >
| > dim strStartDate
| > dim strEndDate
| >
| > strStartDate = Request.QueryString("StartDate")
| > strEndDate = Request.QueryString("EndDate")
| > Set Conn = Server.CreateObject("ADODB.Connection")
| > Set Rs = Server.CreateObject("ADODB.RecordSet")
| > Conn.Open "MaterialEstimating"
| > sSQL = "SELECT * FROM LogSheet WHERE (DateIN >= #::strStartDate::# AND
| > DateIN <= #::strEndDate::#)"
| > Set Rs = Conn.Execute(sSQL)
| > Do While NOT Rs.EOF
| >
|
|
 
Works perfectly now thanks so much everybody. Also I did end up putting
in the isDate checking statement so now it will check for valid dates.
Great suggestion.
 
Back
Top