3 filter syntax?

WinDancer

Registered User.
Local time
Today, 03:37
Joined
Oct 29, 2004
Messages
290
This won't run:

DoCmd.ApplyFilter , "[casestatus]<>'Closed' AND [TickleDate]<>null and [Assignedto]= '" & Environ("UserName") & "'"

Help. please?

Thanks,
Dave
 
DoCmd.ApplyFilter , "[casestatus]<>'Closed' AND [TickleDate] IS NOT null and [Assignedto]= '" & Environ("UserName") & "'"

You forgot about the NOT ISNULL(FIELDNAME) or FIELDNAME IS NOT NULL part from earlier today. :(
 
I am storing the 2 filter combos and the 3 filter combos to work with after this :)

This new code won't run, tho....

Dave
 
Does it give an error or anything?

I personally don't use the DoCmd.ApplyFilter command. I use

Me.Filter = ...etc.
Me.FilterOn = True

but anyway, perhaps using Chr(34) instead of single quotes for the name would be helpful (if any names have single quotes):

DoCmd.ApplyFilter , "[casestatus]<>'Closed' AND [TickleDate] IS NOT null and [Assignedto]= " & Chr(34) & Environ("UserName") & Chr(34)

Or go with the Not IsNull function:

DoCmd.ApplyFilter , "[casestatus]<>'Closed' AND NOT IsNull([TickleDate]) null and [Assignedto]= " & Chr(34) & Environ("UserName") & Chr(34)
 
I apoligize- the original code does work correctly as posted. Thank you for your help, again.

I copied the block of code from the last set of filters [several filters available for this form] for a starting place- and forgot to change the frame number. Stupid mistake. Also stupid not to have double checked everything before my post that it wouldn't run.

And quite elegantly, too.

Thanks for your help and patience!

Dave
 
Whew! Thought I was going bonkers for a sec there. Oh, wait, I already am! :D

Glad we could help.
 

Users who are viewing this thread

Back
Top Bottom