Filter in Access form

ms-access, vba

Solution

Try:

Me.Filter = "[Program_Name]='" & Me.Combo7 & "' AND [Budget_Year]=" & Me.Combo5 

I suspect that program name is text and budget year is numeric. It is possible that the program name combo has an id as the bound column, in which case things might get a little more difficult, probably:

Me.Filter = "[Program_ID]=" & Me.Combo7 & " AND [Budget_Year]=" & Me.Combo5

Problem

I have a form and I want it to be filtered just after it loads. After I click on the form it should be able to load by filtering specific data. I want it to filter by Program Nam and Year. I have tried the following code but I keep getting syntax errors: ``` Private Sub Form_Load() Combo5.Value = Form_0_Cover.Combo0 Combo7.Value = Form_0_Cover.Combo2 'Me.Filter = "[Program_Name]=" & Me.Combo7 & " AND [Budget_Year]='" & Me.Combo5 & "" End Sub ``` I am not sure what the problem seems to be. I keep getting syntax error.

Original source