ChrisCione
Board Regular
- Joined
- Aug 27, 2008
- Messages
- 92
- Office Version
- 365
- Platform
- Windows
Hello,
I found the code below from a very old thread and am attempting to modify. It is hanging on the italicized line, prompting me for a Parameter Value for cboSpecialist. cboSpecialist is the name of the field on the form that I am using as the filter. I.e, match the lstSpecialist selection(s) with cboSpecialist field and display only those records that match.
strFilter = strFilter & "cboSpecialist = """ & Me![lstSpecialist].ItemData(varNumber) & """"
Many thanks for any help.
I found the code below from a very old thread and am attempting to modify. It is hanging on the italicized line, prompting me for a Parameter Value for cboSpecialist. cboSpecialist is the name of the field on the form that I am using as the filter. I.e, match the lstSpecialist selection(s) with cboSpecialist field and display only those records that match.
strFilter = strFilter & "cboSpecialist = """ & Me![lstSpecialist].ItemData(varNumber) & """"
Code:
Private Sub Command79_Click()
On Error GoTo Err_Command79_Click
Dim varNumber As Variant
Dim strFilter As String
If Me.lstSpecialist.ListCount = 0 Then
MsgBox "Please select a Specialist.", vbOKOnly + vbExclamation, "Select a Specialist"
Else
For Each varNumber In Me![lstSpecialist].ItemsSelected
If strFilter <> "" Then
strFilter = strFilter & " or "
End If
strFilter = strFilter & "cboSpecialist = """ & Me![lstSpecialist].ItemData(varNumber) & """"
Next varNumber
DoCmd.OpenForm "frmRecruitment", acNormal, , strFilter
End If
Exit_Command79_Click:
Exit Sub
Err_Command79_Click:
MsgBox Err.Description
Resume Exit_Command79_Click
End Sub
Many thanks for any help.