Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    San Antonio, TX
    Posts
    69

    Unanswered: A97: Need help with a query

    The following select query isn't pulling the right data when done through code:

    "SELECT t2PersonnelTan.kronDo, t2PersonnelTan.tanId AS Id, Trim([t2PersonnelTan]![tanLastName]) & ', ' & Trim([t2PersonnelTan]![tanFirstName]) AS Name, t2PersonnelTan.tanHireDate AS [Hire Date], t2PersonnelTan.tanTermDate AS [Term Date], t2PersonnelTan.kronStatus AS Status, t2PersonnelTan.tanFacilityId, t2PersonnelTan.kronBaseRate, "t2PersonnelTan.kronClassProfile, t2PersonnelTan.tanSsn, t2PersonnelTan.kronUser, t2PersonnelTan.kronResultCode, "t2PersonnelTan.kronResultText, t2PersonnelTan.kronFile, t2PersonnelTan.tanAuditCreateDate, t2PersonnelTan.kronDate, "t2PersonnelTan.tanClass, t2PersonnelTan.kronHomeDept, t2PersonnelTan.tanPhone FROM t2PersonnelTan WHERE "t2PersonnelTan.kronStatus Is Null or t2PersonnelTan.kronStatus >1 And t2PersonnelTan.tanFacilityId = '" & gstrFacility & "' ORDER BY t2PersonnelTan.tanId;"

    Based off the WHERE clause, it should only pull one record from my table. It pulls records seemingly at random. If I remove the "t2PersonnelTan.kronStatus >1 " part, then it pulls the correct record.

    Any ideas?

    Thanks.
    Last edited by punkerboy; 12-17-02 at 20:29.
    "Doing stuff is overrated. Take Hitler for example. He did lots but don't we all wish he'd have just stayed home and gotten stoned?"

  2. #2
    Join Date
    Feb 2002
    Location
    San Antonio, TX
    Posts
    69
    Nm....figured it out....needed to rearrange my WHERE clause

    (original)
    WHERE "t2PersonnelTan.kronStatus Is Null or t2PersonnelTan.kronStatus >1 And t2PersonnelTan.tanFacilityId = '" & gstrFacility & "'


    (corrected)
    WHERE t2PersonnelTan.kronStatus Is Null And t2PersonnelTan.tanFacilityId = '" & gstrFacility & "' or t2PersonnelTan.kronStatus > 1
    "Doing stuff is overrated. Take Hitler for example. He did lots but don't we all wish he'd have just stayed home and gotten stoned?"

Posting Permissions

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