Microsoft
Software
Hardware
Network
Question : Critera Help for query in access if a field is null then ignore crireria
Hi EE
I have created a query which i use in a form to display records. I use the query as a filter.
In one of the fields on the query i want a criteria that is only used if the Unbound field on the form that the query is used for contains Text.
When you 1st open the form the unbound field is blank (field is a combo box)
I want the query to ignore the criteria at this stage as the combo is empty. this then returns all fields.
When you then select a name in the combo box it then uses after update event an Me.requery and now as the combobox has text in it the query now uses this.
I have tried the following:
IIf([Forms]![frmSUBResourc
esTaskDayV
iewALL]![N
ameFilter]
="","",[Fo
rms]![frmS
UBResource
sTaskDayVi
ewALL]![Na
meFilter])
Also
IIf([Forms]![frmSUBResourc
esTaskDayV
iewALL]![N
ameFilter]
Is Null,"",[Forms]![frmSUBRes
ourcesTask
DayViewALL
]![NameFil
ter])
Both of these half work. If you select text in the combo box it works. It doesnt work if the combobox is null. it returns no records.
If the combobox is null or i delete the code in the criteria of the query then it should be finding 7 records.
Answer : Critera Help for query in access if a field is null then ignore crireria
assuming the field you are setting the filter criteria is [FieldX]
IIf([Forms]![frmSUBResourc
esTaskDayV
iewALL]![N
ameFilter]
Is Null,[FieldX],[Forms]![frm
SUBResourc
esTaskDayV
iewALL]![N
ameFilter]
)
Random Solutions
Exchange config for Outlook Anywhere
General User Login Issue "Your account is configured to prevent you from using this computer."
IF/OR formula acting like an IF/AND formula
How to disable multitasking on iOS4 iPhone 3G ?
Best way to make users stay within ranges and warn users of conflicts
Citrix: unable to load/see printers on Mac
Exporting Linux Display in Windows
type="checkbox" and alert in javascript
What new geospatial features are in SQL 2008 R2 but not in SQL 2008
How do I restore a ghost image to different drives/partitions of different size?