Hi All,

In my program I have a combo box that the user selects a date from and a list view that the user selects an employee ID from. How do I properly design my database query string to use both the date selected and the employee ID selected? The date is stored in a variable called YearMonth and the employee ID is stored in a variable called EmpID.

Here is what I am trying to do with my query:
Code:
        Dim ExactQuery As String = _
           "SELECT * " & _
            "FROM[JobTypeExact_Query] WHERE (EMPID = ?) AND WHERE (YEARMONTH = YM)" 'Define Exact job type query

        ExactQuery = ExactQuery.Replace("?", CStr(EmpID)).Replace("YM", CStr(YearMonth)) 'Constrain to Employee and YearMonth chosen
Is there something wrong with my syntax here and/or is there an easier way to accomplish this?

Thanks in advance for your help,
Diana