form filtering

  • Thread starter Thread starter Damon Heron
  • Start date Start date
D

Damon Heron

I have the following code in an option group:

Private Sub optFilters_AfterUpdate()
If optFilters = 2 Then
Me.Filter = "forms!frmOrders!txtCompletedDate= '""'"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub

The problem is it only gives me a new form (blank record), ignoring the 9
orders that don't have a completeddate in them. Any ideas why? This is a
standard single form, tied to a table, and allows entry of new records....
 
Damon said:
I have the following code in an option group:

Private Sub optFilters_AfterUpdate()
If optFilters = 2 Then
Me.Filter = "forms!frmOrders!txtCompletedDate= '""'"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub

The problem is it only gives me a new form (blank record), ignoring the 9
orders that don't have a completeddate in them. Any ideas why? This is a
standard single form, tied to a table, and allows entry of new records....


The filter needs to refer to a **field** in the form's
record source table/query, not a **control** on the form. I
can't tell from what you've posted, but maybe this is close:

Me.Filter = "CompleteDate = "" "

But if that really is a date type field, it will never
contain a zero length string. It would be Null if it has
not been assign a date value so the filter would be:

Me.Filter = "CompleteDate Is Null"
 

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


Back
Top