Private Sub Command1_Click()
If DTPicker1.Value > Date Or DTPicker2.Value > Date Then
MsgBox "Las Fechas de los Rangos no pueden ser mayores a la fecha actual", vbInformation, "CAJA"
Else
If DTPicker1.Value <= DTPicker2.Value Then
Adodc1.Refresh
Adodc2.Refresh
Adodc3.Refresh
Adodc4.Refresh
Adodc1.Recordset.Filter = "fecha >= #" & DTPicker1.Value & "# and fecha <= #" & DTPicker2.Value & "#"
Adodc2.Recordset.Filter = "fecha >= #" & DTPicker1.Value & "# and fecha <= #" & DTPicker2.Value & "#"
Adodc3.Recordset.Filter = "fecha >= #" & DTPicker1.Value & "# and fecha <= #" & DTPicker2.Value & "#"
Adodc4.Recordset.Filter = "fecha >= #" & DTPicker1.Value & "# and fecha <= #" & DTPicker2.Value & "#"
If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then
If Not Adodc2.Recordset.EOF And Not Adodc2.Recordset.BOF Then
If Not Adodc3.Recordset.EOF And Not Adodc3.Recordset.BOF Then
If Not Adodc4.Recordset.EOF And Not Adodc4.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
Adodc2.Recordset.MoveFirst
Adodc3.Recordset.MoveFirst
Adodc4.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF And Not Adodc2.Recordset.EOF And Not Adodc3.Recordset.EOF And Not Adodc4.Recordset.EOF
tut = tut + Adodc1.Recordset!total
tat = tat + Adodc2.Recordset!valor
tet = tet + Adodc3.Recordset!total
tit = tit + Adodc4.Recordset!total
tatg = tatg + tat
tat = 0
Text1.Text = tatg
tutg = tutg + tut
tut = 0
Text3.Text = tutg
tetg = tetg + tet
tet = 0
Text4.Text = tetg
titg = titg + tit
tit = 0
Text2.Text = titg
Text5 = Val(Text1) + Val(Text2) + Val(Text3) - Val(Text4) - Val(Text6)
Adodc1.Recordset.MoveNext
Adodc2.Recordset.MoveNext
Adodc3.Recordset.MoveNext
Adodc4.Recordset.MoveNext
Loop
Else
MsgBox "No hay Datos para mostrar", vbInformation, "CAJA"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End If
Else
MsgBox "La Fecha de Inicio deber ser menor o igual que la Fecha de Finalización", vbInformation, "CAJA"
End If
End If
End If
End If
End If
End Sub