Foros del Web » Programación para mayores de 30 ;) » Programación General »

- Base de Datos - Vb con adocd

Estas en el tema de - Base de Datos - Vb con adocd en el foro de Programación General en Foros del Web. Hola, les comento que use adocd para conectarme a la base de datos, y la muestro en un datagrid. Lo que quiero hacer es que ...
  #1 (permalink)  
Antiguo 27/01/2004, 23:25
r0y
 
Fecha de Ingreso: enero-2004
Ubicación: Buenos Aires
Mensajes: 29
Antigüedad: 20 años, 3 meses
Puntos: 0
- Base de Datos - Vb con adocd

Hola, les comento que use adocd para conectarme a la base de datos, y la muestro en un datagrid. Lo que quiero hacer es que me sume toda la culumna "horas trabajadas" y le de el valor una label cualquiera... con sql seria facil hacerlo, pero como la conexion a la base de datos no esta hecha en código, se me complica.
A continuación paso el código, y luego un link para ver la interface, asi se entiende más.

Código:
Private Sub checkFecha_Click()
If checkFecha.Value = 0 Then
        txtDesde.Enabled = False
        txtHasta.Enabled = False
        Label3.ForeColor = &H8000000C
        Label4.ForeColor = &H8000000C
        txtDesde.BackColor = &HC0C0C0
        txtHasta.BackColor = &HC0C0C0

    ElseIf checkFecha.Value = 1 Then
        txtDesde.Enabled = True
        txtHasta.Enabled = True
        txtDesde = ""
        txtHasta = ""
        Label3.ForeColor = &H80000008
        Label4.ForeColor = &H80000008
        txtDesde.BackColor = &HFFFFFF
        txtHasta.BackColor = &HFFFFFF
End If

End Sub

Private Sub cmdFiltrar_Click()
    If txtOT <> "" And txtEmpleado = "" And checkFecha.Value = 0 Then
        datos.Recordset.Filter = "OT LIKE '" + txtOT + "'"
      End If
     
    If txtEmpleado <> "" And txtOT = "" And checkFecha.Value = 0 Then
        datos.Recordset.Filter = "Empleado LIKE '" + txtEmpleado + "'"
      End If
        
    If txtEmpleado <> "" And txtOT <> "" And checkFecha.Value = 0 Then
        datos.Recordset.Filter = "Empleado LIKE '" + txtEmpleado + "' AND OT LIKE '" + txtOT + "'"
      End If
        
    If txtOT <> "" And txtEmpleado = "" And checkFecha.Value = 1 Then
        If txtDesde <> "" And txtHasta <> "" Then
            datos.Recordset.Filter = "OT LIKE '" + txtOT + "' AND Día > '" + txtDesde + "' AND Día < '" + txtHasta + "'"
        Else
            MsgBox "Llene los campos.", vbInformation
      End If
     End If
     
    If txtEmpleado <> "" And txtOT = "" And checkFecha.Value = 1 Then
        If txtDesde <> "" And txtHasta <> "" Then
            datos.Recordset.Filter = "Empleado LIKE '" + txtEmpleado + "' AND Día > '" + txtDesde + "' AND Día < '" + txtHasta + "'"
        Else
            MsgBox "Llene los campos.", vbInformation
      End If
    End If
    
    If txtEmpleado <> "" And txtOT <> "" And checkFecha.Value = 1 Then
        If txtDesde <> "" And txtHasta <> "" Then
            datos.Recordset.Filter = "Empleado LIKE '" + txtEmpleado + "' AND OT LIKE '" + txtOT + "' AND Día > '" + txtDesde + "' AND Día < '" + txtHasta + "'"
        Else
            MsgBox "Llene los campos.", vbInformation, "Falta Información"
            txtDesde.SetFocus
      End If
    End If
    
    If txtOT = "" And txtEmpleado = "" And checkFecha.Value = 1 Then
        If txtDesde <> "" And txtHasta <> "" Then
               datos.Recordset.Filter = "Día > '" + txtDesde + "' AND Día < '" + txtHasta + "'"
        Else
            MsgBox "Llene los campos.", vbInformation, "Falta Información"
            txtDesde.SetFocus
        End If
    End If
        
  End Sub

Private Sub cmdsacarfiltro_Click()
    datos.Recordset.Filter = ""
    datos.Refresh
End Sub

Private Sub Datos_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
datos.Caption = "Registros totales: " & datos.Recordset.RecordCount
End Sub

Private Sub Form_Load()
    txtDesde.Enabled = False
    txtHasta.Enabled = False
    Label3.ForeColor = &H8000000C
    Label4.ForeColor = &H8000000C
    txtDesde.BackColor = &HC0C0C0
    txtHasta.BackColor = &HC0C0C0
End Sub

Private Sub salir_Click()
End
End Sub

Private Sub txtHasta_GotFocus()
    cmdfiltrar.Default = True
End Sub

Private Sub txtHasta_LostFocus()
    cmdfiltrar.Default = False
End Sub

Private Sub txtOT_GotFocus()
    cmdfiltrar.Default = True
End Sub

Private Sub txtOT_LostFocus()
    cmdfiltrar.Default = False
End Sub

Private Sub txtEmpleado_GotFocus()
    cmdfiltrar.Default = True
End Sub

Private Sub txtEmpleado_LostFocus()
    cmdfiltrar.Default = False
End Sub
En este link pueden ver la interface.

http://r0y.webcindario.com/ot.gif

Les agradecería mucho su ayuda, hace varios dias estoy buscando foros que respondan consultas, espero que este me sea util, yo tratare de ayudar a los demás con lo poco que sé.
Nos vemos.
  #2 (permalink)  
Antiguo 27/01/2004, 23:27
r0y
 
Fecha de Ingreso: enero-2004
Ubicación: Buenos Aires
Mensajes: 29
Antigüedad: 20 años, 3 meses
Puntos: 0
PD: si el link no anda, copien y peguen en el explorador (problema del vbulletin me parece)
  #3 (permalink)  
Antiguo 28/01/2004, 18:09
r0y
 
Fecha de Ingreso: enero-2004
Ubicación: Buenos Aires
Mensajes: 29
Antigüedad: 20 años, 3 meses
Puntos: 0
UP

help plz
  #4 (permalink)  
Antiguo 29/01/2004, 21:56
r0y
 
Fecha de Ingreso: enero-2004
Ubicación: Buenos Aires
Mensajes: 29
Antigüedad: 20 años, 3 meses
Puntos: 0
:@

UP
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:56.