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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a date field for presence of a date

Status
Not open for further replies.

jdgreen

Technical User
Mar 21, 2001
144
US
I have two date fields that I want to filter by. All I am checking for is if there is a date entered or it is blank. Here is what I am working with right now:

Me.Filter = Me![Text173] Is Not Null And Me![Text176] Is Null

I have tried every combination I can think of to test for this information.
 
Lets make sure we're on the right track. You want
all records where Text173 contains data AND Text176 is blank ?

Okay then what you types seems reasonable. I'd prefer

Me.Filter = Len(Text173) > 0 And Len(Text176) = 0
Me.AllowFilters = True



Is it, by any chance, the Allow Filters line that you've missed out that is causing the problem ?


'ope-that-'elps.

G LS
 
Well that didn't do it either. Everytime I click on the option button to filter, I get Run-time error '94': Invalid use of Null. I don't have the Allow Filters line in there, I've been using the FilterOn command instead. I get the error before I get to that point anyway. Thanks.
 
Okay - so when you get the error - go into debug mode and fine the bit that is creating the invalid null - by hovering your mouse pointer over each part of the highlighted line until the tip window comes up with it's value. One of the setions will repeat the error code - Which one is it ?


G LS
 
The two labels that show up are Text173=Null and Text176=Null. I tried putting some dates in Text173 and then it just shows up with Text173=7/2/02.
 
Okay jd - the other possibility is that your controls Text173 and Text176 are not bound to any fields

In that case you need

Me.Filter = Not IsNull(Text173) And IsNull(Text176)



Got there in the end ?

G LS
 
It worked, but the fields are bound. The bad part is I already tried this method only I forgot to use parenthesis instead of brackets. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top