Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: dates and databases


Message #1 by "Tony DiNucci" <tonydinucci@h...> on Sat, 13 Oct 2001 23:21:11
Hi,

Below is a portion of a recordset that I was hoping would only show the 

records in the data base after (date - 30).  However this doesn't seem to 

be working and all records are still being shown.

Thank's in advance to anyone who can tell me where I'm going wrong.



_____________________________________________________________



set craftRS = Server.CreateObject( "ADODB.Recordset" )

craftRS.ActiveConnection = connection

sqlString = "SELECT * FROM craft_details " &_

            "WHERE registration_no = '" & reg_no & "' AND last_flight > " 

& (date - 30)

craftRS.Open sqlString   
Message #2 by "Zee Computer Consulting" <zee@t...> on Sat, 13 Oct 2001 21:29:39 -0700
This might work -- dates can be tricky -- let me know if this helps.



' Get current date and subtract 30 days

CutoffDate = cStr( DateAdd( "d", -30, date ) )



sqlString =  _

"SELECT * FROM craft_details " _

& "WHERE registration_no = '" & reg_no & "'" _

& " AND last_flight > #" & CutoffDate & "#"



---------------









----- Original Message -----

From: "Tony DiNucci" <tonydinucci@h...>

To: "Access ASP" <access_asp@p...>

Sent: Saturday, October 13, 2001 11:21 PM

Subject: [access_asp] dates and databases





> Hi,

> Below is a portion of a recordset that I was hoping would only show the

> records in the data base after (date - 30).  However this doesn't seem to

> be working and all records are still being shown.

> Thank's in advance to anyone who can tell me where I'm going wrong.

>

> _____________________________________________________________

>

> set craftRS = Server.CreateObject( "ADODB.Recordset" )

> craftRS.ActiveConnection = connection

> sqlString = "SELECT * FROM craft_details " &_

>             "WHERE registration_no = '" & reg_no & "' AND last_flight > "

> & (date - 30)

> craftRS.Open sqlString

>



Message #3 by "Tony DiNucci" <tonydinucci@h...> on Sun, 14 Oct 2001 14:11:04
Thank's very much, thats seems to have done it.





> This might work -- dates can be tricky -- let me know if this helps.

> 

> ' Get current date and subtract 30 days

> CutoffDate = cStr( DateAdd( "d", -30, date ) )

> 

> sqlString =  _

> "SELECT * FROM craft_details " _

> & "WHERE registration_no = '" & reg_no & "'" _

> & " AND last_flight > #" & CutoffDate & "#"

> 

> ---------------

> 

> 

> 

> 

> ----- Original Message -----

> From: "Tony DiNucci" <tonydinucci@h...>

> To: "Access ASP" <access_asp@p...>

> Sent: Saturday, October 13, 2001 11:21 PM

> Subject: [access_asp] dates and databases

> 

> 

> > Hi,

> > Below is a portion of a recordset that I was hoping would only show the

> > records in the data base after (date - 30).  However this doesn't seem 

to

> > be working and all records are still being shown.

> > Thank's in advance to anyone who can tell me where I'm going wrong.

> >

> > _____________________________________________________________

> >

> > set craftRS = Server.CreateObject( "ADODB.Recordset" )

> > craftRS.ActiveConnection = connection

> > sqlString = "SELECT * FROM craft_details " &_

> >             "WHERE registration_no = '" & reg_no & "' AND last_flight 

> "

> > & (date - 30)

> > craftRS.Open sqlString

> >

> 


  Return to Index