Hello, I have a report in VB6 that is grouped. The report is for a timeclock program. Currently, with the following code it will display all employees even if they dont have punches for this week:
VB Code:
  1. strSQL = "SHAPE {"
  2.     strSQL = strSQL & "SELECT DISTINCTROW tblTempEmployees.Name, tblTempEmployees.EmployeeID "
  3.     strSQL = strSQL & "FROM tblTempEmployees "
  4.     strSQL = strSQL & "INNER JOIN tblTempTimes ON "
  5.     strSQL = strSQL & "tblTempEmployees.EmployeeID = tblTempTimes.EmployeeID "
  6.     strSQL = strSQL & "ORDER BY tblTempEmployees.Name, tblTempTimes.Date} "
  7.     strSQL = strSQL & "AS Command1 "
  8.     strSQL = strSQL & "APPEND ({"
  9.     strSQL = strSQL & "SELECT DISTINCTROW tblTempEmployees.Name, tblTempTimes.Date, tblTempTimes.TimeIn, tblTempTimes.TimeOut, tblTempTimes.TotalHours, tblTempEmployees.EmployeeID, tblTempEmployees.Shift "
  10.     strSQL = strSQL & "FROM tblTempEmployees "
  11.     strSQL = strSQL & "INNER JOIN tblTempTimes ON "
  12.     strSQL = strSQL & "tblTempEmployees.EmployeeID = tblTempTimes.EmployeeID "
  13.     strSQL = strSQL & "WHERE tblTempTimes.Date BETWEEN '" & StartDate & "' AND '" & EndDate & "' "
  14.     strSQL = strSQL & "ORDER BY tblTempEmployees.Name, tblTempTimes.Date} "
  15.     strSQL = strSQL & "AS Command2 RELATE 'EmployeeID' TO 'EmployeeID') AS Command2"
  16.     Me.Sections("PageHeader").Controls.Item("lblHeader").Caption = "Displaying ALL punches between " & Format(StartDate, "mm-dd-yyyy") & " and " & Format(EndDate, "mm-dd-yyyy")

How can I have it so if there is no punches in tblTempTimes, that the persons name won't be displayed in the report?