If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > DateAdd Function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-03, 16:37
Bigced_21 Bigced_21 is offline
Registered User
 
Join Date: Dec 2002
Location: KY
Posts: 54
Exclamation DateAdd Function

I'm trying to calculate 30 days from the Date_inspection in order to get the Date_Expiration, which is not a field in the database. I just want to display it on the form. I'm having problems displaying the date_expiration on the form could somebody help.

here's my code that I tried to incorporate on to the form in order to display Date_expiration:

Response.Write "<td width='20%'>" & rs1("Date_Inspection") & "</td><td width='20%'>" & rs2("state_no") & "</td><td width='20%'>" & rs2("Nat_Brd_No") & "</td><td width='20%'><input type='text' size='10' name='date_expiration' class='invisible_box'></td>"

this is the function that I'm using in order to get the date
Function Date_Expiration(Date_Inspection As Date) As Date
return DateValue(DateAdd("d", 30, Date_Inspection))
End Function
Reply With Quote
  #2 (permalink)  
Old 03-25-03, 15:40
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
Angry ???

Unless I'm really stupid and missing something... you're not actually including the VALUE of the function in the text box you've named Date_Expiration. Try this...

Tim


__________________________________________________ ______
Response.Write "<td width='20%'>" & rs1("Date_Inspection") & "</td><td width='20%'>" & rs2("state_no") & "</td><td width='20%'>" & rs2("Nat_Brd_No") & "</td><td width='20%'><input type='text' size='10' name='date_expiration' value='" & Date_Expiration(Date_Inspection) & "' class='invisible_box'></td>"
__________________________________________________ ______
Reply With Quote
  #3 (permalink)  
Old 03-25-03, 15:57
farzinm farzinm is offline
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 18
MrWizard you are right.

Bigced_21,
Also you might need to change the function to this

Function Date_Expiration(Date_Inspection)
Date_Expiration= DateValue(DateAdd("d", 30, Date_Inspection))
End Function

from
Function Date_Expiration(Date_Inspection)
return DateValue(DateAdd("d", 30, Date_Inspection))
End Function
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On