• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Filter subform by date

Hello dear expert friends,

I've got to make a form with a subform in it, that is sorted by date. The form (frmPepijn) has a combobox (cmbWeek) with all dates in of all the mondays of the year, so you can view the data of the whole week.

the subform has a field event_planning_date, that is used to sort and to filter on.

Now i would like to have the subform filtered when i update the combobox when the date is the same or 1 more, 2, 3, 4, 5 or 6 more.

Thanks in advance,
$h0rTy
0
Sh0rTy
Asked:
Sh0rTy
1 Solution
 
stevbeCommented:
change subformname to the name of the subform control (not the subform itself)
Private Sub cmbWeek_AfterUpdate()
With Me.subformname.Form
   .Filter = "event_planning_date BETWEEN #" & Me.cmbWeek.Value & "# AND #" & Me.cmbWeek.Value + 6 & "#"
   .FilterOn = True
End With
End Sub

Steve
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now