postermmxvicom
Programmer
I want to have a query that returns all records when nothing is specified for the criteria. The field the criteria is in may or may not have data.
All of the expressions I have tried only return any record for records where the field exists - leaving out ones where the field is null.
Now, obviously, I can set the criteria to Is Null to return all records where the field is null. However, I am having trouble forming an expression for the criteria which:
1) returns only records where the field matches the given number, when a number is given
and
2) returns all records, including those with null values, when no number is given
Here is some examples of what I have tried, some don't work, others fail to work properly.
One last thing: Sometimes I wonder; "Is that someone's signature? Or do they type that at the end of each post?
All of the expressions I have tried only return any record for records where the field exists - leaving out ones where the field is null.
Now, obviously, I can set the criteria to Is Null to return all records where the field is null. However, I am having trouble forming an expression for the criteria which:
1) returns only records where the field matches the given number, when a number is given
and
2) returns all records, including those with null values, when no number is given
Here is some examples of what I have tried, some don't work, others fail to work properly.
Code:
IIf(IsNull([Forms]![LotByMaterialSecondaryAndForm]![FKSecondary]),Like "*" Or Is Null,[Forms]![LotByMaterialSecondaryAndForm]![FKSecondary])
Code:
Like IIf(IsNull([Forms]![LotByMaterialSecondaryAndForm]![FKSecondary]),"*",[Forms]![LotByMaterialSecondaryAndForm]![FKSecondary]) Or Like IIf(IsNull([Forms]![LotByMaterialSecondaryAndForm]![FKSecondary]),Null,[Forms]![LotByMaterialSecondaryAndForm]![FKSecondary])
Code:
IIf(IsNull([Forms]![LotByMaterialSecondaryAndForm]![FKSecondary]),"",[Forms]![LotByMaterialSecondaryAndForm]![FKSecondary])
One last thing: Sometimes I wonder; "Is that someone's signature? Or do they type that at the end of each post?