This is my first post and I've googled for 2 days trying to figure it out. About to lose my mind trying to make this work so I've come to you all for help.
I have a database with over 4000 records in it. New records are input daily via a form. In an attempt to make this easier I wanted to be able to filter this form by month and year through combo box choices. It works...kinda. I have the combo boxes for both month and year and upon changing the month it filters accordingly. However, upon opening the form it asks me for a parameter value. If I type it in everything is kosher but I don't want to type it in every time and can't for the life of me figure out why it's doing it. Additionally the combo boxes are creating new columns on the split form. I don't need these and would prefer that they don't exist. I just want the combo boxes to act as filters not input any data. Lastly I'd like the filters to update whether there is a change to either combo box whereas as it is now it only updates on the month meaning if I change the year I have to go back and change the month for both to update properly. Here is the code I'm using for the combo boxes and attached is a picture of the split form.
Private Sub Month_Change()
'if nothing is filled
If IsNull(Me.Month) And IsNull(Me.Yr) Then
Me.FilterOn = False
Exit Sub
ElseIf Me.Month <> 0 And IsNull(Me.Yr) Then
'if only model is filled
Me.Filter = "MName='" & Me.Month & "'"
ElseIf IsNull(Me.Month) And Me.Yr <> 0 Then
'if only purpose is filled
Me.Filter = "TheYear=" & Me.Yr
ElseIf Me.Month <> 0 And Me.Yr <> 0 Then
'if both model and purpose are filled
Me.Filter = "MName='" & Me.Month & "'" & "AND TheYear=" & Me.Yr
Else: Exit Sub
End If
Me.FilterOn = True
End Sub