C
Christine Vollberg via AccessMonster.com
hey all, need some help, I am trying to get a total sentence to print on a
report based on if the sentence is concurrent or consecutive. Example: If
a defendant is sentenced on 3 charges 2, 4, and 5 years and they are to be
consecutive then I want the total to show 11 years, if they are concurrent
I want the total to show 5 years in an unbound field on the report. Here
is my code but not working, will not show anything at all and gives me no
errors. I may just be putting in the wrong event.
Private Sub Form_AfterUpdate()
Dim TotalYears As Integer
If ConcurrentSentence = -1 Then
TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '" &
Me![CaseNo] & "' And [ChargeSeqNo] = '" & Me!ChargeSeqNo & "' And
[DefendantId]=" & Me![DefendantId])
Else
If ConsecutiveSentence = -1 Then
TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '" &
Me![CaseNo] & "' [DefendantId]=" & Me![DefendantId])
Else
TotalYears = 0
End If
End If
End Sub
Any help would be greatly appreciated. Thanks
Christine
report based on if the sentence is concurrent or consecutive. Example: If
a defendant is sentenced on 3 charges 2, 4, and 5 years and they are to be
consecutive then I want the total to show 11 years, if they are concurrent
I want the total to show 5 years in an unbound field on the report. Here
is my code but not working, will not show anything at all and gives me no
errors. I may just be putting in the wrong event.
Private Sub Form_AfterUpdate()
Dim TotalYears As Integer
If ConcurrentSentence = -1 Then
TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '" &
Me![CaseNo] & "' And [ChargeSeqNo] = '" & Me!ChargeSeqNo & "' And
[DefendantId]=" & Me![DefendantId])
Else
If ConsecutiveSentence = -1 Then
TotalYears = DSum("[Years]", "tblDefChargesSentence", "[CaseNo]= '" &
Me![CaseNo] & "' [DefendantId]=" & Me![DefendantId])
Else
TotalYears = 0
End If
End If
End Sub
Any help would be greatly appreciated. Thanks
Christine