Help

  • Thread starter Thread starter Darren Spooner
  • Start date Start date
D

Darren Spooner

this statement only works when true. WHY?
IIf(IsNull([forms]![formName]![textField1]),[QueryField],([QueryName].[Query
Field]) Like "*" & [forms]![formName]![textField1] & "*")
when the statement is true it will return all of [QueryField], but when it
is false it does not return anything
why?
darren
 
Possibly the field that u r checking with IsNull isnt null
might b better to check the Len(trim[fieldname])) > 0
 
this statement only works when true. WHY?
IIf(IsNull([forms]![formName]![textField1]),[QueryField],([QueryName].[Query
Field]) Like "*" & [forms]![formName]![textField1] & "*")
when the statement is true it will return all of [QueryField], but when it
is false it does not return anything
why?
darren

It doesn't work because you cannot pass an entire SQL expression as a
parameter - only actual field values. Instead, try a criterion of

LIKE "*" & [forms]![formName]![textField1] & "*"

by itself - if textField1 is empty, it will return all records in any
case since you have wildcards.
 
that would work if i had a value for ever record. some records have NULL
values in that field
John Vinson said:
On Thu, 25 Mar 2004 09:34:11 -0600, "Darren Spooner"


It doesn't work because you cannot pass an entire SQL expression as a
parameter - only actual field values. Instead, try a criterion of

LIKE "*" & [forms]![formName]![textField1] & "*"

by itself - if textField1 is empty, it will return all records in any
case since you have wildcards.


this statement only works when true. WHY?
IIf(IsNull([forms]![formName]![textField1]),[QueryField],([QueryName].[Quer
y
Field]) Like "*" & [forms]![formName]![textField1] & "*")
when the statement is true it will return all of [QueryField], but when it
is false it does not return anything
why?
darren
 
that would work if i had a value for ever record. some records have NULL
values in that field

OK then: try

LIKE "*" & [forms]![formName]![textField1] & "*" OR
[forms]![formName]![textField1] IS NULL
 
that works but i returns all records and i need only records that match
textfield1 (includes NULL values sometimes) and textfield2 (and it never has
a NULL value)
so i everything that matches textfield2 and textfield1
if textfield1 is empenty the returns all records that match textfield2 (so
field1 will have NULL and string values)
if user enter something in textfield1 the returns all records that match
textfield2 and textfield1
John Vinson said:
that would work if i had a value for ever record. some records have NULL
values in that field

OK then: try

LIKE "*" & [forms]![formName]![textField1] & "*" OR
[forms]![formName]![textField1] IS NULL
 
Back
Top