If(......, ......, "*")

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I must be having a senior moment. In a query I want to set up a criterion
that says "if a form control is set to True, give me a specific value for
this field, otherwise give me all values for this field." But using "*" as
the 'ELSE' value gives me nothing rather than everything. Somebody please
help me out here!! (My actual code follows.)

IIf([Forms]![frmViewEditEvents]![Requires Spanish]=True,"A","*")
 
Try

Criteria: LIKE IIf([Forms]![frmViewEditEvents]![Requires Spanish]=True,"A","*")

Otherwise you are looking for records where the value is EQUAL to "*"
 
I must be having a senior moment. In a query I want to set up a criterion
that says "if a form control is set to True, give me a specific value for
this field, otherwise give me all values for this field." But using "*" as
the 'ELSE' value gives me nothing rather than everything. Somebody please
help me out here!! (My actual code follows.)

IIf([Forms]![frmViewEditEvents]![Requires Spanish]=True,"A","*")

No IIF is needed: try a criterion

= "A" OR ([Forms]![frmViewEditEvents]![Requires Spanish] = False)


John W. Vinson[MVP]
(no longer chatting for now)
 
That improved things a bit, but still not what I want.
When the form's [Requires Spanish] checkbox is set to True
I get the "A" criterion and the corresponding list of
Spanish-qualified people. But if the value is False I now
get the exact same list, rather than a list of all
speakers with or without Spanish. Puzzles me no end. Any
further thoughts? The new criterion is exactly what you
proposed:

Like IIf([Forms]![frmViewEditEvents]![Requires Spanish] =
True,"A","*")

-----Original Message-----
Try

Criteria: LIKE IIf([Forms]![frmViewEditEvents]![Requires Spanish]=True,"A","*")

Otherwise you are looking for records where the value is EQUAL to "*"
I must be having a senior moment. In a query I want to set up a criterion
that says "if a form control is set to True, give me a specific value for
this field, otherwise give me all values for this field." But using "*" as
the 'ELSE' value gives me nothing rather than everything. Somebody please
help me out here!! (My actual code follows.)

IIf([Forms]![frmViewEditEvents]![Requires Spanish]
=True,"A","*")
.
 
Did you try John Vinson's suggestion elsewhere in this thread?

= "A" OR ([Forms]![frmViewEditEvents]![Requires Spanish] = False)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



LarryP said:
That improved things a bit, but still not what I want.
When the form's [Requires Spanish] checkbox is set to True
I get the "A" criterion and the corresponding list of
Spanish-qualified people. But if the value is False I now
get the exact same list, rather than a list of all
speakers with or without Spanish. Puzzles me no end. Any
further thoughts? The new criterion is exactly what you
proposed:

Like IIf([Forms]![frmViewEditEvents]![Requires Spanish] =
True,"A","*")

-----Original Message-----
Try

Criteria: LIKE IIf([Forms]![frmViewEditEvents]![Requires Spanish]=True,"A","*")

Otherwise you are looking for records where the value is EQUAL to "*"
I must be having a senior moment. In a query I want to set up a criterion
that says "if a form control is set to True, give me a specific value for
this field, otherwise give me all values for this field." But using "*" as
the 'ELSE' value gives me nothing rather than everything. Somebody please
help me out here!! (My actual code follows.)

IIf([Forms]![frmViewEditEvents]![Requires Spanish]
=True,"A","*")
.
 
Back
Top