Filter in Access form

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.

Answers


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

Need Your Help

Best strategy to handle broken network connections?

android synchronization client-server networkstream

i want to keep my app in sync with the Server. The communication between client (android app) and server is handled through JSON Objects / HTTP. What is the best strategy if the connection is not

Is it possible to Pivot data using LINQ?

linq pivot-table

I am new to LINQ, but I am wondering if it is possible to use LINQ to pivot data from the following layout: