Add 2nd condition to filter

scottb
4StarLounger
Posts: 402
Joined: 14 Apr 2010, 15:59

Add 2nd condition to filter

Post by scottb »

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

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add 2nd condition to filter

Post by HansV »

The quotes aren't placed correctly. It should be like this:

Me.Filter = "ActionType = '" & Me.cmbActionTypeFilter & "' And [ProjectID] = " & Forms!frmMeetings!ProjectID
Best wishes,
Hans

scottb
4StarLounger
Posts: 402
Joined: 14 Apr 2010, 15:59

Re: Add 2nd condition to filter

Post by scottb »

That did it. Thank you Hans.