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:
strSQL = "SHAPE {" strSQL = strSQL & "SELECT DISTINCTROW tblTempEmployees.Name, tblTempEmployees.EmployeeID " strSQL = strSQL & "FROM tblTempEmployees " strSQL = strSQL & "INNER JOIN tblTempTimes ON " strSQL = strSQL & "tblTempEmployees.EmployeeID = tblTempTimes.EmployeeID " strSQL = strSQL & "ORDER BY tblTempEmployees.Name, tblTempTimes.Date} " strSQL = strSQL & "AS Command1 " strSQL = strSQL & "APPEND ({" strSQL = strSQL & "SELECT DISTINCTROW tblTempEmployees.Name, tblTempTimes.Date, tblTempTimes.TimeIn, tblTempTimes.TimeOut, tblTempTimes.TotalHours, tblTempEmployees.EmployeeID, tblTempEmployees.Shift " strSQL = strSQL & "FROM tblTempEmployees " strSQL = strSQL & "INNER JOIN tblTempTimes ON " strSQL = strSQL & "tblTempEmployees.EmployeeID = tblTempTimes.EmployeeID " strSQL = strSQL & "WHERE tblTempTimes.Date BETWEEN '" & StartDate & "' AND '" & EndDate & "' " strSQL = strSQL & "ORDER BY tblTempEmployees.Name, tblTempTimes.Date} " strSQL = strSQL & "AS Command2 RELATE 'EmployeeID' TO 'EmployeeID') AS Command2" 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?




Reply With Quote