Visual Basic - Como Pasar Datos de un MSFlexgrid a un DataReport

Life is soft - evento anual de software empresarial
 
Vista:
Imágen de perfil de yordin
Val: 25
Ha aumentado 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Como Pasar Datos de un MSFlexgrid a un DataReport

Publicado por yordin (6 intervenciones) el 13/06/2019 23:04:39
Buenas tardes.

estoy creando un programa en el cual lleno un MSFlexgrid desde una base de datos en Acces, esto lo hace todo excelente, pero necesito que al dar doble click en el flex esta linea se pase a un DataReport a unos RptTexbox y no encuentro la manera.



de momento tengo un form creado donde al dar doble click es llenado cada campo bien con los datos del flex utilizo el siguiente código:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Private Sub Editar()
Dim t5 As Currency, t6 As Currency, t7 As Currency, t8 As Currency
On Error Resume Next
 
        frmEdit.CIA.Caption = Grid1.TextMatrix(Grid1.RowSel, 13)
        frmEdit.FICHA.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 1), "##,##0")
        frmEdit.CEDULA.Caption = Grid1.TextMatrix(Grid1.RowSel, 2) & "-" & Format(Grid1.TextMatrix(Grid1.RowSel, 3), "##,##0")
        frmEdit.NOMBRES.Caption = Grid1.TextMatrix(Grid1.RowSel, 4)
        frmEdit.INGRESO.Caption = Grid1.TextMatrix(Grid1.RowSel, 5)
        frmEdit.EGRESO.Caption = Grid1.TextMatrix(Grid1.RowSel, 6)
        frmEdit.MOTIVO.Caption = Grid1.TextMatrix(Grid1.RowSel, 23)
        frmEdit.ANTIGÜEDAD.Caption = Grid1.TextMatrix(Grid1.RowSel, 24)
        frmEdit.GERENCIA.Caption = Grid1.TextMatrix(Grid1.RowSel, 7)
        frmEdit.DPTO.Caption = Grid1.TextMatrix(Grid1.RowSel, 8)
        frmEdit.CARGO.Caption = Grid1.TextMatrix(Grid1.RowSel, 9)
        frmEdit.CUENTA.Caption = Grid1.TextMatrix(Grid1.RowSel, 26)
        frmEdit.SUELDO.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 10), "##,##0.00")
        frmEdit.ESCALA.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 11), "##,##0.00")
        frmEdit.BONO.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 12), "##,##0.00")
        frmEdit.ABONOS.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 18), "##,##0.00")
        frmEdit.ANTICIPOS.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 19), "##,##0.00")
        frmEdit.FARMACIA.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 21), "##,##0.00")
        frmEdit.MEDICINA.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 20), "##,##0.00")
        frmEdit.DIRECCION.Caption = Format(Grid1.TextMatrix(Grid1.RowSel, 22), "##,##0.00")
 
On Error Resume Next
If IsNumeric(SUELDO) Then t5 = CDec(SUELDO)
If IsNumeric(ESCALA) Then t6 = CDec(ESCALA)
If IsNumeric(BONO) Then t7 = CDec(BONO)
If IsNumeric(PROMEDIO) Then t8 = CDec(PROMEDIO)
PROMEDIO = (t5 + t6 + t7)
 
      frmEdit.Show
      DATA.Hide
 
End Sub

necesito me puedan explicar como llenar el Datareport de igual manera que lleno el Form llamado frmEdit, las cajas de texto del Datareport tienen los nombres idénticos a los campos del grid y del form ejemplo: CIA, FICHA, CEDULA, NOMBRES, ABONOS,DIRECCION EXTC...



espero me puedan colaborar..
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Andres Leonardo
Val: 3.117
Oro
Ha mantenido su posición en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Como Pasar Datos de un MSFlexgrid a un DataReport

Publicado por Andres Leonardo (1798 intervenciones) el 14/06/2019 15:55:13
Ya lo encontre mejor hacer otra consulta


haz la consulta y listo ya lo envias... hay que acomodar el select para que saque por cedula
1
2
3
4
5
6
7
8
9
10
11
12
13
Private Sub Grid1_DblClick()
    If Grid1.RowSel > 0 Then
 
        ssql = "Select * from empleados where cedula= '" & Me.Grid1.TextMatrix(Grid1.RowSel, 2) & "'"
        Rs.Open ssql, conexion
        Set drpEmpleado.DataSource = Rs
        drpEmpleado.Sections("Sección1").Controls("lblCedula").Caption = Rs(2) 'aqui seria la cedula
        drpEmpleado.Sections("Sección1").Controls("lbluCIA").Caption = Rs(13)
         ' aqui debes ir poniendo el resto... s
        drpEmpleado.Show
        Set Rs = Nothing
    End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
2
Comentar