Does the filtering only apply to one report R_TrnHist4SpecificEmp or all? If just the one report, consider changing your code to:
Private Sub Command93_Click()
Dim strReport As String
Dim strWhere As String
strWhere = "1=1 "
Select Case Me.RptOpt
Case Is = 1
strReport = "R_TrainingHistConfig"
DoCmd.RunMacro "TrainingHistConfig"
Case Is = 2
strReport = "R_TrnTrxnClassRoster"
DoCmd.RunMacro "TrnClassRpt"
Case Is = 3
strReport = "R_TrainingClassDetail4DateRange"
DoCmd.RunMacro "TrainingbyDateRanges"
Case Is = 4
strReport = "Report all Active Emp"
Case Is = 5
strReport = "R_Active Emp By Dept"
Case Is = 6
strReport = "R_TrnTrxnScheduleDateRange"
DoCmd.RunMacro "TrainingScheduleDateRange"
Case Is = 7
strReport = "R_TrnTrxnClassRosterDateRange"
DoCmd.RunMacro "TrainingClassRosterDateRange"
Case Is = 8
If Not IsNull(Me.txtName) Then
strWhere = strWhere & " AND [Name] = """ & Me.txtName & """ "
End If
If Not IsNull(Me.CDesc) Then
strWhere = strWhere & " AND [Desc] = """ & Me.CDesc & """ "
End If
' add more controls and where conditions
strReport = "R_TrnHist4SpecificEmp"
End Select
DoCmd.Close acForm, "f_ConfigRpts"
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub
To: MS_Access_Professionals@yahoogroups.com
From: no_reply@yahoogroups.com
Date: Wed, 24 Feb 2016 12:14:17 -0800
Subject: [MS_AccessPros] Re: Need help with a Report
Hi Duane,
I did as you instructed, and the report opens now without asking to enter a parameter value; however, it does not display the data in the report. Did I miss a step? Below is the code I'm using:
Private Sub Command93_Click()
Dim strReport As String
Select Case Me.RptOpt
Case Is = 1
strReport = "R_TrainingHistConfig"
DoCmd.RunMacro "TrainingHistConfig"
Case Is = 2
strReport = "R_TrnTrxnClassRoster"
DoCmd.RunMacro "TrnClassRpt"
Case Is = 3
strReport = "R_TrainingClassDetail4DateRange"
DoCmd.RunMacro "TrainingbyDateRanges"
Case Is = 4
strReport = "Report all Active Emp"
Case Is = 5
strReport = "R_Active Emp By Dept"
Case Is = 6
strReport = "R_TrnTrxnScheduleDateRange"
DoCmd.RunMacro "TrainingScheduleDateRange"
Case Is = 7
strReport = "R_TrnTrxnClassRosterDateRange"
DoCmd.RunMacro "TrainingClassRosterDateRange"
Case Is = 8
Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtName) Then
strWhere = strWhere & " AND [Name] = """ & Me.txtName & """ "
End If
If Not IsNull(Me.CDesc) Then
strWhere = strWhere & " AND [Desc] = """ & Me.CDesc & """ "
End If
' add more controls and where conditions
strReport = "R_TrnHist4SpecificEmp"
DoCmd.OpenReport "R_TrnHist4SpecificEmp", acViewPreview, , strWhere
End Select
DoCmd.Close acForm, "f_ConfigRpts"
DoCmd.OpenReport strReport, acViewPreview
End Sub
Thanks so much for your help!!
Private Sub Command93_Click()
Dim strReport As String
Dim strWhere As String
strWhere = "1=1 "
Select Case Me.RptOpt
Case Is = 1
strReport = "R_TrainingHistConfig"
DoCmd.RunMacro "TrainingHistConfig"
Case Is = 2
strReport = "R_TrnTrxnClassRoster"
DoCmd.RunMacro "TrnClassRpt"
Case Is = 3
strReport = "R_TrainingClassDetail4DateRange"
DoCmd.RunMacro "TrainingbyDateRanges"
Case Is = 4
strReport = "Report all Active Emp"
Case Is = 5
strReport = "R_Active Emp By Dept"
Case Is = 6
strReport = "R_TrnTrxnScheduleDateRange"
DoCmd.RunMacro "TrainingScheduleDateRange"
Case Is = 7
strReport = "R_TrnTrxnClassRosterDateRange"
DoCmd.RunMacro "TrainingClassRosterDateRange"
Case Is = 8
If Not IsNull(Me.txtName) Then
strWhere = strWhere & " AND [Name] = """ & Me.txtName & """ "
End If
If Not IsNull(Me.CDesc) Then
strWhere = strWhere & " AND [Desc] = """ & Me.CDesc & """ "
End If
' add more controls and where conditions
strReport = "R_TrnHist4SpecificEmp"
End Select
DoCmd.Close acForm, "f_ConfigRpts"
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub
To: MS_Access_Professionals@yahoogroups.com
From: no_reply@yahoogroups.com
Date: Wed, 24 Feb 2016 12:14:17 -0800
Subject: [MS_AccessPros] Re: Need help with a Report
Hi Duane,
I did as you instructed, and the report opens now without asking to enter a parameter value; however, it does not display the data in the report. Did I miss a step? Below is the code I'm using:
Private Sub Command93_Click()
Dim strReport As String
Select Case Me.RptOpt
Case Is = 1
strReport = "R_TrainingHistConfig"
DoCmd.RunMacro "TrainingHistConfig"
Case Is = 2
strReport = "R_TrnTrxnClassRoster"
DoCmd.RunMacro "TrnClassRpt"
Case Is = 3
strReport = "R_TrainingClassDetail4DateRange"
DoCmd.RunMacro "TrainingbyDateRanges"
Case Is = 4
strReport = "Report all Active Emp"
Case Is = 5
strReport = "R_Active Emp By Dept"
Case Is = 6
strReport = "R_TrnTrxnScheduleDateRange"
DoCmd.RunMacro "TrainingScheduleDateRange"
Case Is = 7
strReport = "R_TrnTrxnClassRosterDateRange"
DoCmd.RunMacro "TrainingClassRosterDateRange"
Case Is = 8
Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtName) Then
strWhere = strWhere & " AND [Name] = """ & Me.txtName & """ "
End If
If Not IsNull(Me.CDesc) Then
strWhere = strWhere & " AND [Desc] = """ & Me.CDesc & """ "
End If
' add more controls and where conditions
strReport = "R_TrnHist4SpecificEmp"
DoCmd.OpenReport "R_TrnHist4SpecificEmp", acViewPreview, , strWhere
End Select
DoCmd.Close acForm, "f_ConfigRpts"
DoCmd.OpenReport strReport, acViewPreview
End Sub
Thanks so much for your help!!
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar