![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
If [PerCentComp] is a text field maybe: Sum(IIf([TFStatus]="In Testing" AND [PerCentComp] ="100",1,0)) If [PerCentComp] is sometimes Empty/Null, this would cause problems. Maybe then you'd use the Nz function or IsNull test. Example where boolInput could be True, False, or Null: Public Function ReturnStatusIsCurrent(boolInput As Variant) As Variant If Not IsNull(boolInput) Then If boolInput Then ReturnStatusIsCurrent = "Current" Else ReturnStatusIsCurrent = "Historical" End If Else End If End Function |
#4
| |||
| |||
|
| I have a query which interrogates activities in an append query and counts stats up by week, replacing if the week is in use, and adding if it is the first occasion. I have various columns in the append query for counting the various category an activity can be in, one that works perfectly well is: In Testing: This works fine. I have another field in the query which records the percentage of completion of the activity. If it is 100% complete i.e. the PerCentComp field in the underlying query is 100, I would like to count that as well I have tried various combinations like: Sum(IIf([TFStatus]="In Testing" AND [PerCentComp] =100,1,0)) Sum(IIf([TFStatus]="In Testing" AND W[PerCentComp] =100W,1,0)) Sum(IIf([TFStatus]="In Testing" AND "[PerCentComp] ='"100"'",1,0)) But nothing appears to work. Is this in fact imposible to do or have I just got the syntax wrong? Thanks J |
#5
| |||
| |||
|
|
I have a query which interrogates activities in an append query and counts stats up by week, replacing if the week is in use, and adding if it is the first occasion. I have various columns in the append query for counting the various category an activity can be in, one that works perfectly well is: In Testing: This works fine. I have another field in the query which records the percentage of completion of the activity. If it is 100% complete i.e. the PerCentComp field in the underlying query is 100, I would like to count that as well I have tried various combinations like: Sum(IIf([TFStatus]="In Testing" AND [PerCentComp] =100,1,0)) Sum(IIf([TFStatus]="In Testing" AND W[PerCentComp] =100W,1,0)) Sum(IIf([TFStatus]="In Testing" AND "[PerCentComp] ='"100"'",1,0)) But nothing appears to work. Is this in fact imposible to do or have I just got the syntax wrong? Thanks J |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
The errors are around syntax, apart from when I us the first option, which just returns 0. The PerCentComp column in the query contains from 0 - 100 as an integer, another way of doing the math would be to use another column when I use the append query using IIF then I would just use the SUM(IIF as in all the other fields (there are more categories that the query sums) |
#8
| |||
| |||
|
| I have a query which interrogates activities in an append query and counts stats up by week, replacing if the week is in use, and adding if it is the first occasion. I have various columns in the append query for counting the various category an activity can be in, one that works perfectly well is: In Testing: This works fine. I have another field in the query which records the percentage of completion of the activity. If it is 100% complete i.e. the PerCentComp field in the underlying query is 100, I would like to count that as well I have tried various combinations like: Sum(IIf([TFStatus]="In Testing" AND [PerCentComp] =100,1,0)) Sum(IIf([TFStatus]="In Testing" AND W[PerCentComp] =100W,1,0)) Sum(IIf([TFStatus]="In Testing" AND "[PerCentComp] ='"100"'",1,0)) But nothing appears to work. Is this in fact imposible to do or have I just got the syntax wrong? Thanks J |
![]() |
| Thread Tools | |
| Display Modes | |
| |