Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by date selected in combobox

Status
Not open for further replies.

rsynan

Programmer
Mar 22, 2002
6
US
I have a form with a combo box that has a select query as a Row Source. My code for the cboAfterUpdate event is below. When I select a date from the combo box, the combo box displays a blank and the form shows an empty record 1 of 1 (filtered) --no error message. I can't figure out what is wrong. Thanks for helping.
Code:
Private Sub cboRunDate_AfterUpdate()
    ' Filter form after date in combo box is selected.
   Dim datSelectedDate As Date

   ' Store date selected in combo box.
   datSelectedDate = cboRunDate.Value

   ' Filter form by valid date.
   With Form_frm_DuesInvoicePayment.Form
      ' If date is greater than 1998, then filter on that value.
      If datSelectedDate > #12/31/1998# Then
         .Filter = "[RunDate]=" & datSelectedDate
         .FilterOn = True
      ' If date is prior to 1999, remove filter.
      Else
         .FilterOn = False
      End If
   End With

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top