I am relatively new to using VBA and am have been trying for two days to pass a user entered value to my report for filtering when opened. I have the following subroutine in the open event of my report:
When my form opens I am prompted for the business unit. When a valid business unit is entered Access brings up a second prompt with the title: "Enter Parameter Value" with the value of my filter variable where the text prompt would go: (ex. DB69A would show as the text for the second prompt).
Can someone please tell me how to get rid of this second prompt and get access to use the value I am passing in variable strBusUnitName to filter the report.
Thank you.
Private Sub Report_Open(Can cel As Integer)
'Prompts for business unit when run educational assistance reports.
Dim strBusUnitName As String
strBusUnitName = UCase(InputBox( "Enter Business Unit or click OK for all.", "Business Unit", "All"))
Me.Filter = ""
Select Case strBusUnitName
Case Is = "DB17A", "DB50A", "DB69A", "DB70A", "DB71A", "DB85A"
End Select
'Prompts for business unit when run educational assistance reports.
Dim strBusUnitName As String
strBusUnitName = UCase(InputBox( "Enter Business Unit or click OK for all.", "Business Unit", "All"))
Me.Filter = ""
Select Case strBusUnitName
Case Is = "DB17A", "DB50A", "DB69A", "DB70A", "DB71A", "DB85A"
Me.Filter = "[EmpBusinessUnit]= " & strBusUnitName
Me.FilterOn = True
Case Is = "ALL"Me.FilterOn = True
Me.FilterOn = False
Case Is = ""Me.FilterOn = False
Cancel = True
Case ElseCancel = True
MsgBox "Business Unit Not Found. Please Verify and Retry."
Cancel = True
Cancel = True
End Select
When my form opens I am prompted for the business unit. When a valid business unit is entered Access brings up a second prompt with the title: "Enter Parameter Value" with the value of my filter variable where the text prompt would go: (ex. DB69A would show as the text for the second prompt).
Can someone please tell me how to get rid of this second prompt and get access to use the value I am passing in variable strBusUnitName to filter the report.
Thank you.
Comment