dbTalk Databases Forums  

Using "Is Null" in Filter on subform

comp.databases.ms-access comp.databases.ms-access


Discuss Using "Is Null" in Filter on subform in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ecovindaloo
 
Posts: n/a

Default Using "Is Null" in Filter on subform - 01-26-2011 , 06:25 PM






I'm trying to filter on a subform and I have a date field that I want
to use
for the filter. So the result I'm trying to get is to return all the
records
on a subform where the date field is null.

Here's a few things that I have tried and none seem to be working:

strWhere = "Trim(" &
Me.subInspectionSchedules2010.Form.InspStartDateCa t1 & ")
= ''"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1 & " Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = "isnull (" &
Me.subInspectionSchedules2010.Form.InspStartDateCa t1
& ")"
Me.subInspectionSchedules2010.Form.Filter = strWhere

I know that I'm probably just missing something really simple. Any
help
would be appreciated.

Reply With Quote
  #2  
Old   
Marshall Barton
 
Posts: n/a

Default Re: Using "Is Null" in Filter on subform - 01-26-2011 , 10:55 PM






Ecovindaloo wrote:

Quote:
I'm trying to filter on a subform and I have a date field that I want
to use
for the filter. So the result I'm trying to get is to return all the
records
on a subform where the date field is null.

Here's a few things that I have tried and none seem to be working:

strWhere = "Trim(" &
Me.subInspectionSchedules2010.Form.InspStartDateCa t1 & ")
= ''"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1 & " Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = "isnull (" &
Me.subInspectionSchedules2010.Form.InspStartDateCa t1
& ")"
Me.subInspectionSchedules2010.Form.Filter = strWhere

If you are not certain that the subform's FilterOn property
is set, add the line:

strWhere =
Me.subInspectionSchedules2010.Form.InspStartDateCa t1 & " Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere
Me.subInspectionSchedules2010.Form.FilterOn = True

--
Marsh

Reply With Quote
  #3  
Old   
John Spencer
 
Posts: n/a

Default Re: Using "Is Null" in Filter on subform - 01-27-2011 , 08:03 AM



Doesn't a filter need to be a string and include the name of a field?

StrWhere = "[NAME OF FIELD] Is Null"

Or perhaps the following if (for some unknown reason) the name of the field
you want to filter on is unknown.

StrWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1.ControlSource
& " is Null"


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 1/26/2011 11:55 PM, Marshall Barton wrote:
Quote:
Ecovindaloo wrote:

I'm trying to filter on a subform and I have a date field that I want
to use
for the filter. So the result I'm trying to get is to return all the
records
on a subform where the date field is null.

Here's a few things that I have tried and none seem to be working:

strWhere = "Trim("&
Me.subInspectionSchedules2010.Form.InspStartDateCa t1& ")
= ''"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1& " Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = "isnull ("&
Me.subInspectionSchedules2010.Form.InspStartDateCa t1
& ")"
Me.subInspectionSchedules2010.Form.Filter = strWhere


If you are not certain that the subform's FilterOn property
is set, add the line:

strWhere =
Me.subInspectionSchedules2010.Form.InspStartDateCa t1& " Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere
Me.subInspectionSchedules2010.Form.FilterOn = True

--
Marsh

Reply With Quote
  #4  
Old   
Ecovindaloo
 
Posts: n/a

Default Re: Using "Is Null" in Filter on subform - 01-27-2011 , 08:35 AM



Thanks for all the help. It turns out that John was correct. By
adding controlsource to the name of the field that solved the
problem. I knew that I was close.

Thanks again. Now I can proceed with the next piece of the project!



On Jan 27, 9:03*am, John Spencer <JSPEN... (AT) Hilltop (DOT) umbc> wrote:
Quote:
Doesn't a filter need to be a string and include the name of a field?

StrWhere = "[NAME OF FIELD] Is Null"

Or perhaps the following if (for some unknown reason) the name of the field
you want to filter on is unknown.

StrWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1.ControlSource
& " is Null"

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 1/26/2011 11:55 PM, Marshall Barton wrote:

Ecovindaloo wrote:

I'm trying to filter on a subform and I have a date field that I want
to use
for the filter. *So the result I'm trying to get is to return all the
records
on a subform where the date field is null.

Here's a few things that I have tried and none seem to be working:

strWhere = "Trim("&
Me.subInspectionSchedules2010.Form.InspStartDateCa t1& *")
= ''"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = Me.subInspectionSchedules2010.Form.InspStartDateCa t1& *" Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere

strWhere = "isnull ("&
Me.subInspectionSchedules2010.Form.InspStartDateCa t1
& *")"
Me.subInspectionSchedules2010.Form.Filter = strWhere

If you are not certain that the subform's FilterOn property
is set, add the line:

strWhere =
Me.subInspectionSchedules2010.Form.InspStartDateCa t1& *" Is
Null"
Me.subInspectionSchedules2010.Form.Filter = strWhere
Me.subInspectionSchedules2010.Form.FilterOn = True

--
Marsh

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.