
21/11/2008, 11:30
|
| | Fecha de Ingreso: noviembre-2006
Mensajes: 227
Antigüedad: 18 años, 6 meses Puntos: 6 | |
Respuesta: Buscar Mediante dos Tablas Gracias Avellaneda, si hace la busqueda y me coloca los registros pero si coloca una fecha que no existe en la tabla asistencia de cualquier forma me muestra todo el padron de la tabla Principal cuando deberia decirme que no encontro ningun registro. este es todo mi codigo.
Código:
Private Sub CmdBuscarInasistencia_Click()
Dim Fila As Integer, I As Integer
If Not (IsDate(TxtFechaIni.Value) And IsDate(TxtFechaFin.Value)) Then
MsgBox " Una de las Fechas esta Equivocada por favor Verifica ", vbInformation, "Información al Usuario..."
Exit Sub
ElseIf CDate(TxtFechaIni.Value) > CDate(TxtFechaFin.Value) Then
MsgBox " La Fecha INICIO no debe ser superior a la FINAL, por favor verifica bien los datos...", vbInformation, "Información al Usuario..."
Exit Sub
End If
If rs.State = 1 Then rs.Close
rs.Open "SELECT * FROM Principal WHERE Clave NOT IN (SELECT NumEmpleado FROM Asistencias WHERE FechaReunion " & _
"BETWEEN #" & Format(TxtFechaIni, "mm/dd/yyyy") & "# " & _
"AND #" & Format(TxtFechaFin, "mm/dd/yyyy") & "# " & _
") ORDER BY Clave", cnn, adOpenStatic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "No se encontraron registros Probablemente todo el personal si acudio a su reunión", vbInformation, "Departamento No Encontradas..."
CmdImprimedepto.Enabled = False
MsHAsistencias.Visible = False
Else
MsHAsistencias.Visible = True
Call HistorialInAsistencias(MsHAsistencias)
TextTotalReg.Text = rs.RecordCount
CmdImprimir.Enabled = True
End If
End Sub
y Gracias por tu ayuda. |