If Null

Mike Hughes

Registered User.
Local time
Today, 22:13
Joined
Mar 23, 2002
Messages
493
This query is used to determine the number of days between the last payment being received and today. If there has never been a payment (no MAX DISB date) the field is empty. Is there a way to have something like NULL inserted in the days field for that record & can you show me how to do it?
Thanks

SELECT
Date()-[MAX DISB] AS DAYS,
[21].[MAX DISB],
[20].[CHECK RECP],
[20].[CLIENT ARR],
[20].A1,
[20].A2,
[20].A3,
[20].CITY,
[20].STATE,
[20].ZIP INTO 22

FROM 20 INNER JOIN 21 ON [20].[CHECK RECP] = [21].[CHECK RECP]

ORDER BY Date()-[MAX DISB], [20].ZIP;
 
Here is what you could use:

SELECT IIf(IsNull([MAX DISB]), NULL, Date()-[MAX DISB]) AS DAYS, .....

Basically the syntax is IIf(condition, to_do_if_true, to_do_if_false) AS field_name

I don't know about your particuliar situation but I don't see why you would be interested in having a record with no payment. You could get rid of them by a WHERE clause...

Hope that helps.

Simon B.
 

Users who are viewing this thread

Back
Top Bottom