I am using CR 8.5. I have a TimeSheet report in which I only want to report on the selected employee. For test purposes, I have 14 records of one employee and 1 record for another employee. However, my report shows all the records instead of the employee I select. I don't know if I need to adjust the setting in the report or my SQL statement. I have attached my code below.
VB Code:
Private Sub PrintTimeSheet() Dim oApp As CRAXDRT.Application Dim oReport As CRAXDRT.Report mSQL = "Select A.*, " & _ "B.*, " & _ "C.* " & _ "From tblTime A, " & _ "tblPayPeriods B, " & _ "tblProjects C " & _ "Where (A.ppID = B.ppID) and " & _ "(A.projectID = C.prjInternalProjID) and" & _ "(A.employee = '" & mstrEmployee & "') " & _ "Order By A.employee, A.projectID" If OpenDBConnection Then Set rs = New ADODB.Recordset Set rs = cn.Execute(mSQL) Set oApp = New CRAXDRT.Application Set oReport = oApp.OpenReport("C:\Reports\rptTimeSheet.rpt", 1) oReport.Database.SetDataSource rs, 3, 1 frmReport.cr1.ReportSource = oReport frmReport.cr1.ViewReport End If End Sub
The key is the mstrEmployee field. That value is what makes the entire report unique.
Thanks,
-Blake




Reply With Quote