R
RICK
Hi everyone,
I have a table with a field called "Colors" with 10
different records, each with it's own unique color. I
created a query based on this table called "Colors Query."
I created a form called "Colors Form" with two text boxes
on it "color1", and "color2", and a command button. Here's
how i want the button to work:
if both boxes are empty, the button opens the query and
all 10 colors are produced.
if one box has a color and the other is empty, then i want
it to only return the record with the matching color.
if both boxes are full, i want it to be like an "OR"
statment in that teh query will produce all records with
colors that match either color in either text box.
here is the SQL statement i have now, (which doens't work)
=[Forms]![Colors Form]![color1] OR [Forms]![Colors Form]!
[color2] OR [Forms]![Colors Form]![color1] is null OR
[Forms]![Colors Form]![color2] is null
i find that it returns all records if nothing is
specified, (which is what i want). It works how i want if
i put values in both text boxes. However if i specify a
color in only one text box and leave the other blank, it
always returns all records. What am i doing wrong?
rick
I have a table with a field called "Colors" with 10
different records, each with it's own unique color. I
created a query based on this table called "Colors Query."
I created a form called "Colors Form" with two text boxes
on it "color1", and "color2", and a command button. Here's
how i want the button to work:
if both boxes are empty, the button opens the query and
all 10 colors are produced.
if one box has a color and the other is empty, then i want
it to only return the record with the matching color.
if both boxes are full, i want it to be like an "OR"
statment in that teh query will produce all records with
colors that match either color in either text box.
here is the SQL statement i have now, (which doens't work)
=[Forms]![Colors Form]![color1] OR [Forms]![Colors Form]!
[color2] OR [Forms]![Colors Form]![color1] is null OR
[Forms]![Colors Form]![color2] is null
i find that it returns all records if nothing is
specified, (which is what i want). It works how i want if
i put values in both text boxes. However if i specify a
color in only one text box and leave the other blank, it
always returns all records. What am i doing wrong?
rick