Access Filter

I have a form, and I want it to be filtered right after it is loaded.

After I click on the form, it should be able to load by filtering certain data. I want it to be filtered out by the Nam and Year program.

I 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 is. I keep getting syntax error.

+4
source share
1 answer

Try:

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

I suspect that the name of the program is text and the fiscal year is numerical. It is possible that the program name command has an identifier as a related column, in which case the situation may be a little difficult, perhaps:

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

All Articles