Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    KY
    Posts
    56

    Exclamation Unanswered: 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

  2. #2
    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>"
    __________________________________________________ ______

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •