Date Filter

D

Dave

I'm trying to filter a subform with a toggle button. When the button
is depressed it should toggle between those records that have a date
and those that don't. It should be a simple filtering technique but I
can't get it working(What else is new!) Any help would be
appreciated..

Dave
 
D

Dale Fye

What are you doing now?

I would expect your code to look something like:

Private Sub toggle_Click

if me.toggle.Value = -1 then
me.Filter = "[DateField] IS NULL"
else
me.Filter = "[DateField] IS NOT NULL"
endif
me.filteron = true

End Sub
 
D

Dave

What are you doing now?

I would expect your code to look something like:

Private Sub toggle_Click

   if me.toggle.Value = -1 then
       me.Filter = "[DateField] IS NULL"
   else
       me.Filter = "[DateField] IS NOT NULL"
   endif
   me.filteron = true

End Sub
----
HTH
Dale



Dave said:
I'm trying to filter a subform with a toggle button. When the button
is depressed it should toggle between those records that have a date
and those that don't. It should be a simple filtering technique but I
can't get it working(What else is new!)  Any help would be
appreciated..
Dave- Hide quoted text -

- Show quoted text -

Thanks Dale,

I tried just about every combination of stuff except something like
that. I've been inserting #'s because I thought you had to for a date.
I guess not!.

Dave
 
J

John W. Vinson

I've been inserting #'s because I thought you had to for a date.
I guess not!.

The # marks are used to define a "date literal" - a string of characters
intended to represent a particular date/time value, such as #9/12/2009# or
#10-Apr-2005#. They're not needed just because the field being searched is of
date/time type - [Datefield] IS NULL or IS NOT NULL works because you're not
specifying any particular date.
 

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

Top