Bawn
Bawn

Reputation: 509

SQL criteria set to form

I have searched for this question and though I found the answer but I cant get it to work

This is the Link I followed:

passing combobox value into sql query MS ACCESS

Here is my SQL code im using, but when I run it nothing comes up, I have a Product_ID selected in the combo box before I run it but there is still nothing showing up.

SELECT [1 Cut Wire & Cable Only].Element
  FROM [1 Cut Wire & Cable Only]
 WHERE  ((
                "[1 Cut Wire & Cable Only].Product_ID" = [Forms]![New Report]!
                [cbProduct_ID]
        ));

I have made sure the combo box is called cbProduct_ID and the form is called New Report.

[1 Cut Wire & Cable Only] is the name of the table

I am doing any thing in particle wrong ?

Upvotes: 0

Views: 99

Answers (2)

matzone
matzone

Reputation: 5719

Try this ..

SELECT Element FROM [1 Cut Wire & Cable Only] WHERE [1 Cut Wire & Cable Only].Product_ID
= [Forms]![New Report]![cbProduct_ID]

Upvotes: 1

Drop the double quotes, and close up the whitespace.

SELECT [1 Cut Wire & Cable Only].Element
  FROM [1 Cut Wire & Cable Only]
 WHERE  (
           [1 Cut Wire & Cable Only].Product_ID = [Forms]![New Report]![cbProduct_ID]
        );

Upvotes: 1

Related Questions