Jump to content

philipjbailey

Members
  • Posts

    1
  • Joined

  • Last visited

About philipjbailey

  • Birthday 04/29/1954

Profile Information

  • Location
    Ayrshire, Scotland
  • Interests
    Computing, Web Development, Poetry

philipjbailey's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. [*] Hi I have a work around for this one but for other reasons I want to work with numeric dates e.g. 01/02/2010 rather than string dates e.g. 1 February 2010. IF I use the Visual basic adate = CDate(#1/2/2010#) all works perfectly and adate would have the value 01/02/2010 in date format. Here is where the problem starts. The date is captured from an ASP Form using form dropdowns for day and month so the code looks like this Dim xday, xmonth, xyear, adate xday = Request.Form("xday") xmonth = Request.Form("xmonth") xyear = Request.Form("xyear") adate = CDate("#" & aday & "/" & amoth & "/" & ayear & "#") Result is a Type Mismatch The problem is obvious CDate("#" & aday & "/" & amonth & "/" & ayear & "#") Is effectively equivalent to CDate("#01/02/2010#") (a String Value) Causing the Error as the required value #01/02/2010# is not a string value. Question: How do I convert the Concatenated String "#01/02/2010#" into the correct format for CDate to work correctly so that the value adate can be inserted into a Database Date Field? The work Around uses the Month Names I.e February and code CDate(aday & " " & amonth & " " & ayear) Which does work but requires the extra coding later on to covert amonth to a numeric month number.
×
×
  • Create New...