Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    27

    Unanswered: inserting a date

    I want to enter today's date when an application form is approved/rejected. I am setting this in a hidden textbox in my form.
    Code:
     <tr>
     <td><input type="hidden" name="hdnDate" value="<%response.write(FormatDateTime(date(), vbLongDate))%>"></td>
     </tr>
    when the send this information to the database, I get the following error:
    Type mismatch: 'FormatDateTime'

    Here is the relevant code that I use when updating to the database:
    Dim date, today
    date = request.form("hdnDate")
    today = FormatDateTime(date, vbLongDate)

    sql = "UPDATE MEMBER SET APP_STATUS = '" & varAccess & "', NEW_APPLICATION = '" & varNewApp & "', TODAYS_DATE = '" & today & "', COMMENTS = '" & comm & "' WHERE MEMBER_ID = " & varMemberID & ""

    the data type of the field in the database is Date/Time.

    Please help.........

  2. #2
    Join Date
    Dec 2003
    Posts
    454
    <tr>
    <td><input type="hidden" name="hdnDate" value="<%= Now() %>">
    </td>
    </tr>

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    Actually, you do not need a hidden type. When you execute your SQL statement, you just put Now().

    sql = "UPDATE MEMBER SET APP_STATUS = '" & varAccess & "', NEW_APPLICATION = '" & varNewApp & "', TODAYS_DATE = '" & Now() & "', COMMENTS = '" & comm & "' WHERE MEMBER_ID = " & varMemberID

  4. #4
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    And of course Date() is like Now() but without the time part.
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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