need only the records where.....

T

tamxwell

This query is for agings debts. I want only to pull the records that are 1-45
days old. I've tried a number of ways ,but it still gives me all 56000
records instead of "just what is 1-45". Here is my query

SELECT
tblARDetail.[co-number] AS Branch, tblARDetail.[divn-number] AS SubBranch,
tblARDetail.[cust-number] AS CustomerNumber, tblARDetail.[cust-name] AS
CustomerName, [tblARDetail]![trans-code] & [tblARDetail]![item-type] AS
TranType, tblARDetail.[ref-number] AS ReferenceNumber,
tblARDetail.[as-of-date], tblARDetail.[due-date], tblARDetail.[item-amount],
Now() AS Today,
DateDiff("d",[Due-Date],[Today]) AS DSO,

IIf([item-amount]<0,0,IIf(([DSO])<45 And ([DSO])>1 ,[item-amount],0)) AS
[1-45],

tblCustusage.CA, tblCustusage.CM

FROM tblARDetail INNER JOIN tblCustusage ON (tblARDetail.[co-number] =
tblCustusage.Company) AND (tblARDetail.[cust-number] = tblCustusage.Acct)

ORDER BY tblARDetail.[co-number], tblARDetail.[divn-number],
tblARDetail.[cust-number], tblARDetail.[as-of-date];
 
G

George Nicholson

FROM......

WHERE (DateDiff("d",[Due-Date], Now()) >1) AND (DateDiff("d",[Due-Date],
Now()) <45) AND ([item-amount]<>0)

ORDER BY.....

HTH,
 
T

tamxwell

SWEET!

George Nicholson said:
FROM......

WHERE (DateDiff("d",[Due-Date], Now()) >1) AND (DateDiff("d",[Due-Date],
Now()) <45) AND ([item-amount]<>0)

ORDER BY.....

HTH,
--
George Nicholson

Remove 'Junk' from return address.


tamxwell said:
This query is for agings debts. I want only to pull the records that are
1-45
days old. I've tried a number of ways ,but it still gives me all 56000
records instead of "just what is 1-45". Here is my query

SELECT
tblARDetail.[co-number] AS Branch, tblARDetail.[divn-number] AS SubBranch,
tblARDetail.[cust-number] AS CustomerNumber, tblARDetail.[cust-name] AS
CustomerName, [tblARDetail]![trans-code] & [tblARDetail]![item-type] AS
TranType, tblARDetail.[ref-number] AS ReferenceNumber,
tblARDetail.[as-of-date], tblARDetail.[due-date],
tblARDetail.[item-amount],
Now() AS Today,
DateDiff("d",[Due-Date],[Today]) AS DSO,

IIf([item-amount]<0,0,IIf(([DSO])<45 And ([DSO])>1 ,[item-amount],0)) AS
[1-45],

tblCustusage.CA, tblCustusage.CM

FROM tblARDetail INNER JOIN tblCustusage ON (tblARDetail.[co-number] =
tblCustusage.Company) AND (tblARDetail.[cust-number] = tblCustusage.Acct)

ORDER BY tblARDetail.[co-number], tblARDetail.[divn-number],
tblARDetail.[cust-number], tblARDetail.[as-of-date];
 

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

Using NULL 1
HELP WITH "WHERE" clause 2
More Help withthe WHERE Clause 2
calculating sums 21
UNION ALL- CALCULATING SUMS 1
USING THE "IN CLAUSE" 4
Need help with Where Clause 1
Need to write a query 5

Top