Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    1

    Unanswered: SQL cast operators in MS Access

    Hi,

    I'm trying to "connect" two fields of the diferent types, one of them is STRING, and the other is DATE.

    SELECT firstName, lastName
    FROM tblPerson, tblPerson1
    WHERE tblPerson.Date = tblPerson1.Date
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AND tblPerson.Date LIKE '7.4.2003'

    tblPerson.Date is STRING type field
    tblPerson1.Date is DATE type field

    I've tried using in my ASP code:
    WHERE tblPerson.Date = CStr(tblPerson1.Date)

    but when I execute the query, the recordset is empty.
    The thing is, when I try the same query in MS Access query editor, it works !?!?

    Please help, Neven

  2. #2
    Join Date
    Mar 2003
    Location
    Atlanta, GA
    Posts
    191

    let's see...

    I'm no expert on field type issues, but since you say it works fine in MSAccess, I would try:

    WHERE CStr(tblPerson.Date) = CStr(tblPerson1.Date)

    or CDate(tblPerson.Date) = tblPerson1.Date


    Tim
    Tim

  3. #3
    Join Date
    Feb 2003
    Posts
    109

    also could be a problem with time

    you could be having a problem where you

    are trying to join where '3/13/2003' = '3/13/2003 6:00am' and it isnt matching.
    Access 2002 ADP Rocks my World

    Long live SQL Server and 64bit Windows!!!

Posting Permissions

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