G
Guest
Hi,
I'm looking for assistance as I have been researching this problem by
reading the threads for the last few days and I'm unable to resolve myself.
On my startup form there is a section where one can request one of three
reports using either command button for Preview or Print. However, the
audience may not want to see all data for all employees or centres;
therefore, I created unbound textboxes for the audience to select what
criteria to base the report on.. with the intent that they can use more than
one criteria at once. The criteria is: AgentName, Coach, Centre,
CreatedDate, Period or PeriodWeek. These are all dropdown boxes except for
CreatedDate where the data is manually entered.
When just trying to get a report to work based on Agent Name alone, this is
the code for Preview button:
Private Sub PreviewReport_Click()
On Error GoTo Err_PreviewReport_Click:
Dim pstcriteria As String
pstrcriteria = "[2nd Level Support
Table.AgentName]=[forms]![DataEntryForm]!me!AgentNameSelect"
Select Case SelectReport
Case 1
DoCmd.OpenReport "Employee Case Creation Details", acViewPreview, ,
pstrcriteria
Case 2
DoCmd.OpenReport "Pending Cases Report", acViewPreview, , pstrcriteria
Case 3
DoCmd.OpenReport "Employee Coaching Received", acViewPreview, ,
pstrcriteria
End Select
Exit_PreviewReport_Click:
Exit Sub
Err_PreviewReport_Click:
MsgBox Error$
Resume Exit_PreviewReport_Click
End Sub
Coding for AgentName txtbox:
Private Sub AgentNameSelect_AfterUpdate()
Dim pstrcriteria As String
pstrcriteria = "[2nd Level Support
Table.AgentName]=[forms]![DataEntryForm]!me!AgentNameSelect"
Select Case SelectReport
Case 1
DoCmd.OpenReport "Employee Case Creation Details", acViewPreview, ,
pstrcriteria
Case 2
DoCmd.OpenReport "Pending Cases Report", acViewPreview, , pstrcriteria
Case 3
DoCmd.OpenReport "Employee Coaching Received", acViewPreview, ,
pstrcriteria
End Select
End Sub
When I run the Preview button, I receive a Parameter Value error :
Forms!DataEntryForm!me!AgentNameSelect
Is someone able to advise what the correct coding is, especially if I want
to have a number of criteria selections.
Thank You.
I'm looking for assistance as I have been researching this problem by
reading the threads for the last few days and I'm unable to resolve myself.
On my startup form there is a section where one can request one of three
reports using either command button for Preview or Print. However, the
audience may not want to see all data for all employees or centres;
therefore, I created unbound textboxes for the audience to select what
criteria to base the report on.. with the intent that they can use more than
one criteria at once. The criteria is: AgentName, Coach, Centre,
CreatedDate, Period or PeriodWeek. These are all dropdown boxes except for
CreatedDate where the data is manually entered.
When just trying to get a report to work based on Agent Name alone, this is
the code for Preview button:
Private Sub PreviewReport_Click()
On Error GoTo Err_PreviewReport_Click:
Dim pstcriteria As String
pstrcriteria = "[2nd Level Support
Table.AgentName]=[forms]![DataEntryForm]!me!AgentNameSelect"
Select Case SelectReport
Case 1
DoCmd.OpenReport "Employee Case Creation Details", acViewPreview, ,
pstrcriteria
Case 2
DoCmd.OpenReport "Pending Cases Report", acViewPreview, , pstrcriteria
Case 3
DoCmd.OpenReport "Employee Coaching Received", acViewPreview, ,
pstrcriteria
End Select
Exit_PreviewReport_Click:
Exit Sub
Err_PreviewReport_Click:
MsgBox Error$
Resume Exit_PreviewReport_Click
End Sub
Coding for AgentName txtbox:
Private Sub AgentNameSelect_AfterUpdate()
Dim pstrcriteria As String
pstrcriteria = "[2nd Level Support
Table.AgentName]=[forms]![DataEntryForm]!me!AgentNameSelect"
Select Case SelectReport
Case 1
DoCmd.OpenReport "Employee Case Creation Details", acViewPreview, ,
pstrcriteria
Case 2
DoCmd.OpenReport "Pending Cases Report", acViewPreview, , pstrcriteria
Case 3
DoCmd.OpenReport "Employee Coaching Received", acViewPreview, ,
pstrcriteria
End Select
End Sub
When I run the Preview button, I receive a Parameter Value error :
Forms!DataEntryForm!me!AgentNameSelect
Is someone able to advise what the correct coding is, especially if I want
to have a number of criteria selections.
Thank You.