User Define Criteria

VINAY-NARAN

New member
Local time
Today, 06:14
Joined
Oct 10, 2008
Messages
7
Please find attachment.
I would like Query depending on below criteria

where I can Enter Branch code
or Just Press Enter for all branches

below sql works fine for secons option
but when I try with brach code 1 its give all braches start with 1

What im' missing on below sql

SELECT [201].[3digit], [201].ordtyp, [201].branch, [201].bname, Sum([201].[Net Sales]) AS [SumOfNet Sales], Sum([201].Cost) AS SumOfCost, Sum([201].Qty1) AS SumOfQty1, [201].Month, [201].Year
FROM 201
GROUP BY [201].[3digit], [201].ordtyp, [201].branch, [201].bname, [201].Month, [201].Year
HAVING ((([201].branch) Like [Branch Code OR Press Enter To Continue] & "*"));




Regards

Vinay
 

Attachments

Change this:

Code:
HAVING ((([201].branch) Like [Branch Code OR Press Enter To Continue] & "*"));

to this:

Code:
HAVING ((([201].branch)=[Branch Code OR Press Enter To Continue]));

eg remove the LIKE syntax

JR
 
Last edited:
Having tested it a bit a better solution will perhaps be:

Code:
HAVING ((([201].branch) [COLOR=red]Like[/COLOR] [Branch Code OR Press Enter To Continue]));

The parameter to enter will either be 1, 2 etc or the user use the wildcard *

JR
 

Users who are viewing this thread

Back
Top Bottom