![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |