You can call the AfterUpdate event procedure of the combo box in the Form's
load event procedure e.g.
cboMonths_AfterUpdate
Normally the event won't be executed when the form loads as you are not
actually selecting an item from the combo box, but calling the event
procedure causes it to execute as though you had.
Or, if your code in the combo box's AfterUpdate procedure is filtering the
form by means of its Filter and FilterOn properties, you can explicitly
filter the form in the same way in its Load event procedure:
Me.Filter = "Month([YourDateField]) = " & Month(VBA.Date)
Me.FilterOn = True
Or, if the data is restricted by a reference to the combo box as a parameter
in the form's underlying query requerying the form in its Load event
procedure should do it:
Me.Requery
I assume that the form's underlying recordset covers only one year's data.
Otherwise filtering solely on the month, but not the year also, will return
records for that month from each year not just the current year.
Ken Sheridan
Stafford, England
Secret Squirrel said:
I already have a select query for my records on this form. I'm using the
combo box to filter my records right now. Everything filters properly but I
just want to have it filter to the current month when the form is opened.
Will the after update event requery the records even if I don't select
anything from the combo box since it is already defaulted to the current
month?
Do I just put this on the after update event? Me.Requery