Problems with simple select Statement

  • Having problems with what shoud be a simple select statement..

    Returned recordset is not as desired..

    Table name is ServiceReport

    I pass a department number and employee number in the statement

    Adodc1.RecordSource = "Select * from Servicereport where (employeenumber= " & CurrentEmployeeNumber & "and PrintStatus  = 'Pending'or Department =" & CurrentDepartment & "and PrintStatus  = 'NonApproved'  ) Order By ReportDate desc"

    I need the statement to only return records for current employeenumber where Printstatus is Pending, and return records where department =currentdepartment and printstatus =NonApproved.

    Any help would be much appreciated..

    Bob

     

     

     

  • Try this:

     

    Adodc1.RecordSource = "Select * from Servicereport where (employeenumber= " & CurrentEmployeeNumber & "and PrintStatus  = 'Pending') or (Department =" & CurrentDepartment & "and PrintStatus  = 'NonApproved'  ) Order By ReportDate desc"

     

    Kathi

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • Thank you Kathi

    Problem solved...

    Bob

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply