filtering records in form

G

Guest

Some help please. I have created a combo box on form to find a due date.
Once the due date is foud I would like to filter the records in the database
by the due date. I have created the combo box and used and afterupdate event
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[FeeId] = " & Str(Nz(Me![Combo24], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

then I have used the following for the filter

Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
If Me.Combo24 <> "" Then
Me.Filter = COMB024 = Me.DueDate
Me.FilterOn = True

End If

However, the records are not filtered and I am stuck as coding here is very
new to me. Any help would be greatly appreciated
 
D

Douglas J. Steele

The filter needs to look like a WHERE clause without the word WHERE in it.

Assuming that the field in your recordsource that you're trying to filter on
is named DueDate (the Me is incorrect in this context), and that you're
using the date from COMBO24 to do that filtering, try:

Me.Filter = "DueDate = " & Format(Me.COMBO24, "\#mm\/dd\/yyyy\#")

(dates need to be delimited with # characters, and should be in mm/dd/yyyy
format, regardless of what your Short Date format has been set to)

T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top