I am trying to add a second value to a filter called from a combo box.
On my form (frmProjectActionItems) I have a combo box (cmbActionTypeFilter, data type text) with an after update event:
'Me.Filter = "ActionType = '" & Me.cmbActionTypeFilter & "'"
Me.FilterOn = True
That part works. I am trying to add a second condition to the filter string with a numeric value from a numeric field on an open form (frmProjects) MeetingID.
I am trying:
Me.Filter = "ActionType = '" & Me.cmbActionTypeFilter & "'" And [ProjectID] = " & =Forms!frmMeetings!ProjectID"
Me.FilterOn = True
Which gives me a run time error 13, data type mismatch. I have tried to find examples of the proper syntax but can’t seem to get it right.
Thank you for much for any assistance.
-Scott
Add 2nd condition to filter
-
- Administrator
- Posts: 78235
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Add 2nd condition to filter
The quotes aren't placed correctly. It should be like this:
Me.Filter = "ActionType = '" & Me.cmbActionTypeFilter & "' And [ProjectID] = " & Forms!frmMeetings!ProjectID
Me.Filter = "ActionType = '" & Me.cmbActionTypeFilter & "' And [ProjectID] = " & Forms!frmMeetings!ProjectID
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 402
- Joined: 14 Apr 2010, 15:59
Re: Add 2nd condition to filter
That did it. Thank you Hans.