Get records when field values are equal

G

Guest

Hi
I want to have a query that returns the records where the values from Field1
or Field2 of a table named “Items†are equal to the value given by a Combo
Box (“cboSelectValueâ€).
So I’ve made the SQL statement.
SELECT Items.Field0, Items.Field1, Items.Field2
FROM Items
WHERE (((Items!Field1 Or Items!Field2) Like
Forms!frmSelectValue!cboSelectValue));
When the Combo has the value “*†I get all the records, but when it is set
to another value, I get no records.
Do you know what is wrong?

Thanks in advance

GL
 
G

Guest

Try and separate the or statement

SELECT Items.Field0, Items.Field1, Items.Field2
FROM Items
WHERE Items.Field1 Like Forms!frmSelectValue!cboSelectValue Or Items.Field2
Like Forms!frmSelectValue!cboSelectValue

You you should name the fields with meaningful names, its easy to understand
what each field stand for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top