Criteria in Consult

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é.
 
D

Douglas J. Steele

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é.
 
K

KARL DEWEY

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

Similar Threads

Medium Price 2
Consult to Insert Data 3
Problem in Consult 0
Consult with 10 bigger values 2
Need some PWA help 0
Dsum and Dmax with structured references 1
Delete Consult 6
Graph question in Access2007 5

Top