If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
DateDiff and Count/Sum
I am trying to count records where the scheduled date is greater than the
current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#2
|
|||
|
|||
DateDiff and Count/Sum
Where are you doing this? In a query?
Could you use a query, include the [Date of Awareness] field, and in the criteria, use something like (untested): Date() Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "caro" wrote in message ... I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#3
|
|||
|
|||
DateDiff and Count/Sum
What was the result for
=Abs(Sum([Date of Awareness] Date())) Where did you enter this? What section of the report? -- Duane Hookom Microsoft Access MVP "caro" wrote: I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#4
|
|||
|
|||
DateDiff and Count/Sum
Your =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0))
has closing parenthesis misplaced like this -- =IIF(DateDiff("d", [Date of Awareness], Date())1,1,0) Your =Abs(Sum([Date of Awareness] Date())) is missing an IIF like this -- =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) and it does not need the Abs function. -- Build a little, test a little. "caro" wrote: I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#5
|
|||
|
|||
DateDiff and Count/Sum
Karl,
Aren't these the same: =Abs(Sum([Date of Awareness] Date())) =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) This expression will return -1 for true or 0 for false [Date of Awareness] Date() If you Sum() this expression, it will return a negative count of the number of records that return true. Changing the negative to positive with Abs() should provide the same value as your suggestion. Or, did I miss something? -- Duane Hookom Microsoft Access MVP "KARL DEWEY" wrote: Your =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) has closing parenthesis misplaced like this -- =IIF(DateDiff("d", [Date of Awareness], Date())1,1,0) Your =Abs(Sum([Date of Awareness] Date())) is missing an IIF like this -- =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) and it does not need the Abs function. -- Build a little, test a little. "caro" wrote: I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#6
|
|||
|
|||
DateDiff and Count/Sum
You did not miss anything, I just do not know a lot of things.
-- Build a little, test a little. "Duane Hookom" wrote: Karl, Aren't these the same: =Abs(Sum([Date of Awareness] Date())) =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) This expression will return -1 for true or 0 for false [Date of Awareness] Date() If you Sum() this expression, it will return a negative count of the number of records that return true. Changing the negative to positive with Abs() should provide the same value as your suggestion. Or, did I miss something? -- Duane Hookom Microsoft Access MVP "KARL DEWEY" wrote: Your =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) has closing parenthesis misplaced like this -- =IIF(DateDiff("d", [Date of Awareness], Date())1,1,0) Your =Abs(Sum([Date of Awareness] Date())) is missing an IIF like this -- =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) and it does not need the Abs function. -- Build a little, test a little. "caro" wrote: I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
#7
|
|||
|
|||
DateDiff and Count/Sum
Karl,
I have learned a lot from your past posts so I was a bit concerned I had messed up the syntax/expression. -- Duane Hookom Microsoft Access MVP "KARL DEWEY" wrote: You did not miss anything, I just do not know a lot of things. -- Build a little, test a little. "Duane Hookom" wrote: Karl, Aren't these the same: =Abs(Sum([Date of Awareness] Date())) =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) This expression will return -1 for true or 0 for false [Date of Awareness] Date() If you Sum() this expression, it will return a negative count of the number of records that return true. Changing the negative to positive with Abs() should provide the same value as your suggestion. Or, did I miss something? -- Duane Hookom Microsoft Access MVP "KARL DEWEY" wrote: Your =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) has closing parenthesis misplaced like this -- =IIF(DateDiff("d", [Date of Awareness], Date())1,1,0) Your =Abs(Sum([Date of Awareness] Date())) is missing an IIF like this -- =Abs(Sum(IIF([Date of Awareness] Date(), 1, 0))) and it does not need the Abs function. -- Build a little, test a little. "caro" wrote: I am trying to count records where the scheduled date is greater than the current date. All Dates (past visits and scheduled visits) are listed in the Date of Awareness field. The expressions I have tried include: =IIF(DateDiff("d", [Date of Awareness], Date()1,1,0)) =Abs(Sum([Date of Awareness] Date())) Please let me know if I am even on the right track. -Caro |
Thread Tools | |
Display Modes | |
|
|