Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: How to set expiry date in MS Access 2000


Message #1 by "Joaquim Fonseca" <russo@m...> on Tue, 11 Jun 2002 04:30:48
Hi All,


I am having a problem with a database that I am learning to develop. In my 
databade I have the information of expiry date. I want the database to 
compare that information with current date and display "EXPIRED" in the 
form and report. Can anyone help me on how to do that?

Thanks,

Quim
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 11 Jun 2002 13:37:12 +1000
Use the IIF() function - look in Access online help

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Joaquim Fonseca" <russo@m...>
Subject: [access_asp] How to set expiry date in MS Access 2000


: I am having a problem with a database that I am learning to develop. In my
: databade I have the information of expiry date. I want the database to
: compare that information with current date and display "EXPIRED" in the
: form and report. Can anyone help me on how to do that?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #3 by "Tim Morford" <tmorford@n...> on Tue, 11 Jun 2002 09:42:50 -0400
Well one way that you can go about this would be to open your table and loop
thought the records that date() = objRS("Date")

Something like
If date() = objRS("Date") Then
	strExp = "EXPIRED"
Else
	strExp = objRS("Date")
End if

response.write(strExp)

or you could turn your .asp page in to a .vbs page and run it nightly to
update the database again with the if statements.

If date() = objRS("Date") then
	update table set date = "EXPIRED" where Id = intCurr
end if

I hope this helps.
Tim Morford
http://www.speaking-of.net
http://www.aspalliance.com/tmorford

-----Original Message-----
From: Joaquim Fonseca [mailto:russo@m...]
Sent: Tuesday, June 11, 2002 4:31 AM
To: Access ASP
Subject: [access_asp] How to set expiry date in MS Access 2000


Hi All,


I am having a problem with a database that I am learning to develop. In my
databade I have the information of expiry date. I want the database to
compare that information with current date and display "EXPIRED" in the
form and report. Can anyone help me on how to do that?

Thanks,

Quim

Message #4 by "Ken Schaefer" <ken@a...> on Wed, 12 Jun 2002 16:36:33 +1000
IIF() is better:

SELECT
    IIF(DateField < Date(), "Expired", DateField)
FROM
    TableInQuestion

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Tim Morford" <tmorford@n...>
Subject: [access_asp] RE: How to set expiry date in MS Access 2000


: Well one way that you can go about this would be to open your table and
loop
: thought the records that date() = objRS("Date")
:
: Something like
: If date() = objRS("Date") Then
: strExp = "EXPIRED"
: Else
: strExp = objRS("Date")
: End if
:
: response.write(strExp)
:
: or you could turn your .asp page in to a .vbs page and run it nightly to
: update the database again with the if statements.
:
: If date() = objRS("Date") then
: update table set date = "EXPIRED" where Id = intCurr
: end if
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index