Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    4

    Unanswered: Compare Date as string type in Crystal Report

    I am using MS Access as backend and Vb6.0 as front end. In the database, 'ConnDate' is a field which data type is string and it stores connection date. I want to view a report (Crystal report 9) within a specific date range. I also pass values of the parameters(in Crystal report 9) from the vb6.0 program. How can I do this? Please give some help.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Change the 'ConnDate' column datatype to Date & Time.

    For the time being I'm moving this thread to Microsoft Access Forum, although I could also make a case for moving it to the Crystal Reports forum too.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jul 2010
    Posts
    4
    When we query the table to find a record in the maximum date, we write max(cdate(ConnDate)) and it find out the record in max date. Is there any such solution so that we convert the string to date and find out the result within a date range? We do not want to change the data type.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you have stored your dates as a string/text value then you have to be prepared to do the conversion process.
    the date datatype is there for a purpose, the date/time functions (such as datediff, dateadd and so on likewise)

    if you've decided for what ever reason to use text/string as the datatype to store a date/time value then its up to you.......

    generally its better to pay the pain early on to convert the column to the 'correct' datatype than to press on regardless with the 'wrong' datatype
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jul 2010
    Posts
    4
    I changed the data type to Date & Time. But unable to fetch record within a date range. Can you please breifly described what should I write in Record Selection Formula Editor?

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what SQL did you use to attempt to retrieve a record in the date range
    bear in mind that its a datetime column so the time element can be critical

    depending on how you have populated the datetime column you may need to specify day + one to the upper limit.

    eg
    where mydatevalue >=startdate and mydatevalue<=dateadd("d",1enddate)
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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