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

Filter form where field value is Null 1

Status
Not open for further replies.

addy

Technical User
May 18, 2001
743
GB
Please help, this is driving me insane.

I have a button on my form which when clicked, it should filter my form. I want to filter it to show all records where a particular field is Null.

I have tried every possible combination I can think of for the DoCmd.ApplyFilter method but I cannot get it to work where a field value is Null.

In Form design view, if I put:

PrimaryAllocation = ""

in the Filter criteria under the Data tab it works.

However, I need it to run from a button click, I have tried:

DoCmd.Applyfilter, "PrimaryAllocation = Null"
DoCmd.Applyfilter, "PrimaryAllocation = 'Null'"
DoCmd.Applyfilter, "PrimaryAllocation is Null"
DoCmd.Applyfilter, "IsNull(PrimaryAllocation)"

etc. etc.

How do I apply a form filter where a field value is Null?

This is really beginning to wind me up!
 
what about something like this ?
Code:
Me.Filter = "Trim(PrimaryAllocation & '') = ''"
Me.FilterOn = True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
As always PHV - your advice works perfectly.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top