C
Christine Vollberg via AccessMonster.com
Hi all again, I have this report with a subform, in the subform it prints
out the number of years sentenced for each charge running either
concurrently or consecutively, if concurrently I want it to give me the
largest number for TotalYears sentenced, if consecutive I need it to give
me the sum of all years. I cannnot get this to work, I have tried for 6
straight days looking at this, starting to make me nuts. Here is my code:
Private Sub TotalYears_AfterUpdate()
If Me!ConcurrentSentence = False And Me!ConsecutiveSentence = False Then
DoCmd.CancelEvent
Else
If Me!ConcurrentSentence = True Then
Me!TotalYears = DMax("[Years]", "tblDefChargesSentence", "[CaseNo]= '"
& Me![CaseNo] & "' And [DefendantId]=" & Me![DefendantId])
Else
If Me!ConsecutiveSentence = True Then
Me!TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '"
& Me![CaseNo] & "' And [DefendantId]=" & Me![DefendantId])
End If
End If
End If
End Sub
Any help will be greatly appreciated.
Thanks in advance
out the number of years sentenced for each charge running either
concurrently or consecutively, if concurrently I want it to give me the
largest number for TotalYears sentenced, if consecutive I need it to give
me the sum of all years. I cannnot get this to work, I have tried for 6
straight days looking at this, starting to make me nuts. Here is my code:
Private Sub TotalYears_AfterUpdate()
If Me!ConcurrentSentence = False And Me!ConsecutiveSentence = False Then
DoCmd.CancelEvent
Else
If Me!ConcurrentSentence = True Then
Me!TotalYears = DMax("[Years]", "tblDefChargesSentence", "[CaseNo]= '"
& Me![CaseNo] & "' And [DefendantId]=" & Me![DefendantId])
Else
If Me!ConsecutiveSentence = True Then
Me!TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '"
& Me![CaseNo] & "' And [DefendantId]=" & Me![DefendantId])
End If
End If
End If
End Sub
Any help will be greatly appreciated.
Thanks in advance