If TotalLb > 44 Then R = TotalLb - 44Else R = 0End If
Select Sum(AM_lb) AS AM1, Sum(PM_lb) AS PM1, Sum(Total_lb) As Total1, Sum(Clausula) As Clau26, Sum(AM_ext_d) As AM2, Sum(PM_ext_d) As PM2, Sum(Total_ext_d) As Total2, Sum(AM_ext_n) As AM3, Sum(PM_ext_n) As PM3, Sum(Total_ext_n) As Total3 From chl_tb Where NumEmp=30915 And Fecha Between #08/05/2007# And #20/05/2007#
Select Sum(AM_lb) AS AM1, Sum(PM_lb) AS PM1, Sum(Total_lb) As Total1, (Select (Sum(Total_lb)-44) As TotalLb From chl_tb Where TotalLb > 44) As Clau26, Sum(AM_ext_d) As AM2, Sum(PM_ext_d) As PM2, Sum(Total_ext_d) As Total2, Sum(AM_ext_n) As AM3, Sum(PM_ext_n) As PM3, Sum(Total_ext_n) As Total3 From chl_tb Where NumEmp=30915 And Fecha Between #08/05/2007# And #20/05/2007#
Select Sum(AM_lb) AS AM1, Sum(PM_lb) AS PM1, Sum(Total_lb) As Total1, Sum(Clausula) As Clau26, Sum(AM_ext_d) As AM2, Sum(PM_ext_d) As PM2, Sum(Total_ext_d) As Total2, Sum(AM_ext_n) As AM3, Sum(PM_ext_n) As PM3, Sum(Total_ext_n) As Total3 From chl_tb Where NumEmp=30915And Fecha Between #08/05/2007# And #20/05/2007#
He probado algo como:CitarSelect Sum(AM_lb) AS AM1, Sum(PM_lb) AS PM1, Sum(Total_lb) As Total1,(Select (Sum(Total_lb)-44) As TotalLb From chl_tb Where TotalLb > 44) As Clau26,Sum(AM_ext_d) As AM2, Sum(PM_ext_d) As PM2, Sum(Total_ext_d) As Total2,Sum(AM_ext_n) As AM3, Sum(PM_ext_n) As PM3, Sum(Total_ext_n) As Total3From chl_tbWhere NumEmp=30915And Fecha Between #08/05/2007# And #20/05/2007#
Select Sum(AM_lb) AS AM1, Sum(PM_lb) AS PM1, Sum(Total_lb) As Total1,(Select (Sum(Total_lb)-44) As TotalLb From chl_tb Where TotalLb > 44) As Clau26,Sum(AM_ext_d) As AM2, Sum(PM_ext_d) As PM2, Sum(Total_ext_d) As Total2,Sum(AM_ext_n) As AM3, Sum(PM_ext_n) As PM3, Sum(Total_ext_n) As Total3From chl_tbWhere NumEmp=30915And Fecha Between #08/05/2007# And #20/05/2007#
Dim AMLb As Double Dim PMLb As Double Dim TotalLb As Double Dim Clausula26 As Double Dim AMextD As Double Dim PMextD As Double Dim TotalextD As Double Dim AMextN As Double Dim PMextN As Double Dim TotalextN As Double With Data2.Recordset While Not .EOF '....................................... 'AM: (Horario Laboral Normal) If IsNumeric(![AM1]) = False Then Exit Sub Else AMLb = Val(AMLb) + Val(![AM1]) End If '....................................... 'PM: (Horario Laboral Normal) If IsNumeric(![PM1]) = False Then Exit Sub Else PMLb = Val(PMLb) + Val(![PM1]) End If '....................................... 'Total1: (Total Horas Laboradas) If IsNumeric(![Total1]) = False Then Exit Sub Else TotalLb = TotalLb + Val(![Total1]) End If '....................................... 'Clausula 26: If IsNumeric(![Total1]) = False Then Exit Sub End If If Val(![Total1]) > 44 Then Clausula26 = Clausula26 + Val(![Total1]) - 44 Else Clausula26 = 0 End If '....................................... 'AM Extra Diurna: If IsNumeric(![AM2]) = False Then Exit Sub Else AMextD = AMextD + Val(![AM2]) End If '....................................... 'PM Extra Diurna: If IsNumeric(![PM2]) = False Then Exit Sub Else PMextD = PMextD + Val(![PM2]) End If '....................................... 'Total Extra Diurnas: If IsNumeric(![Total2]) = False Then Exit Sub Else TotalextD = TotalextD + Val(![Total2]) End If '....................................... 'AM Extra Nocturna: If IsNumeric(![AM3]) = False Then Exit Sub Else AMextN = AMextN + Val(![AM3]) End If '....................................... 'PM Extra Nocturna: If IsNumeric(![PM3]) = False Then Exit Sub Else PMextN = PMextN + Val(![PM3]) End If '....................................... 'Total Extra Nocturna: If IsNumeric(![Total3]) = False Then Exit Sub Else TotalextN = TotalextN + Val(![Total3]) End If '....................................... .MoveNext Wend End With LbAM1.Caption = AMLb LbPM1.Caption = PMLb LbTotal1.Caption = TotalLb LbClau26.Caption = Clausula26 LbAM2.Caption = AMextD LbPM2.Caption = PMextD LbTotal2.Caption = TotalextD LbAM3.Caption = AMextN LbPM3.Caption = PMextN LbTotal3.Caption = TotalextN