Criteria in Consult

  • Thread starter Thread starter gatarossi
  • Start date Start date
G

gatarossi

Dear all,

I'm trying to do a consult in ms access. Then I have one criteria that
the user need to insert the value.

SELECT table1.entity, Sum(table1.sales_quantity) AS Expr1
FROM table1
GROUP BY table1.entity
HAVING (((table1.entity)=[Insert de Data:]));


But I don´t known what to do when the user want the all information,
whithout criterias...

How can I do it?

Thanks a lot!!!

André.
 
Change your SQL to

SELECT table1.entity, Sum(table1.sales_quantity) AS Expr1
FROM table1
GROUP BY table1.entity
WHERE table1.entity=[Insert de Data:]
OR [Insert de Data:] IS NULL

In that way, they can simply hit Enter when prompted, and everything will
appear.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Dear all,

I'm trying to do a consult in ms access. Then I have one criteria that
the user need to insert the value.

SELECT table1.entity, Sum(table1.sales_quantity) AS Expr1
FROM table1
GROUP BY table1.entity
HAVING (((table1.entity)=[Insert de Data:]));


But I don´t known what to do when the user want the all information,
whithout criterias...

How can I do it?

Thanks a lot!!!

André.
 
Try this ---
WHERE ((table1.entity) Like IIF([Insert de Data:] Is Null, "*",[Insert de
Data:]));
 

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

Back
Top