Filtrado de una matriz de control textbox visual6
Hola experto, si pudieras orientarme de como puedo filtrar una matriz textbox, el problema es que me traigo la información que necesito de la bd (access) a una serie de matrices textbox pero solo tomo como referencia una matriz textbox para cargar la info, pero me trae todos los registros y necesito filtrar la matriz para que solo cargue en los textbox solo registroz diferente, si me puedes orientar de como podría hacer esto a si puedo cargar la info de otra manera más eficiente te adjunto parte del código,
Dim oRst2 As New Recordset
Sql"select cod_insumos,SeccionesDE.cod_insumo,consumo,PNDE,estado,fecha,aceptacion"
Sql = Sql + " From articulos,isumosXarticulos,SeccionesDE,isumos "
Sql = Sql + "Where articulos.cod_articulo like '" + cmb_cod.Text + "'and "
''Sql = Sql + "facturacion.cod_articulo = isumosXarticulos.cod_articulo and "
Sql = Sql + "articulos.cod_articulo = isumosXarticulos.cod_articulo and "
Sql = Sql + "isumosXarticulos.cod_insumos = isumos.cod_insumo and "
Sql = Sql + "isumos.cod_insumo = SeccionesDE.cod_insumo and "
Sql = Sql + "SeccionesDE.estado = 1 and aceptacion <> ' ' and PNDE > 0 order by SeccionesDE.cod_insumo,fecha "
With oRst2
.Open Sql, Obj_Cnx, adOpenStatic, adLockReadOnly
.MoveFirst
Dim s As Integer
Dim Var As Double
Dim var1 As Double
Dim var2 As Double
Dim var3 As Double
Var = 0
var1 = 0
var2 = 0
var3 = 0
While Not oRst2.EOF
On Error GoTo error
Dim san As Integer
For san = 0 To txtcampo1.Count - 1
txtcampo1(san).Text = oRst2.Fields("cod_insumo")
txt_aceptacio(san).Text = oRst2.Fields("aceptacion")
txt_consumo(san).Text = oRst2.Fields("consumo")
txt_consumotatal(san).Text = Str(txt_consumo(san).Text) * Str(txt_canti.Text)
txt_inv_PNDE(san).Text = oRst2.Fields("PNDE")
var3 = Str(txt_inv_PNDE(san).Text) - Str(txt_consumotatal(san).Text)
If var3 < 0 Then
txt_newinve(san).Text = 0
Else
txt_newinve(san).Text = var3
End If
var1 = Str(txt_newinve(san).Text)
var2 = Str(txt_consumotatal(san).Text)
Var = var1 + var2
newinvePNDE2(san).Text = Var
fecha(san).Text = oRst2.Fields("fecha")
oRst2.MoveNext
Next san
Exit Sub
error:
Wend
End With
oRst2.Close
Set oRst2 = Nothing
End Sub
Dim oRst2 As New Recordset
Sql"select cod_insumos,SeccionesDE.cod_insumo,consumo,PNDE,estado,fecha,aceptacion"
Sql = Sql + " From articulos,isumosXarticulos,SeccionesDE,isumos "
Sql = Sql + "Where articulos.cod_articulo like '" + cmb_cod.Text + "'and "
''Sql = Sql + "facturacion.cod_articulo = isumosXarticulos.cod_articulo and "
Sql = Sql + "articulos.cod_articulo = isumosXarticulos.cod_articulo and "
Sql = Sql + "isumosXarticulos.cod_insumos = isumos.cod_insumo and "
Sql = Sql + "isumos.cod_insumo = SeccionesDE.cod_insumo and "
Sql = Sql + "SeccionesDE.estado = 1 and aceptacion <> ' ' and PNDE > 0 order by SeccionesDE.cod_insumo,fecha "
With oRst2
.Open Sql, Obj_Cnx, adOpenStatic, adLockReadOnly
.MoveFirst
Dim s As Integer
Dim Var As Double
Dim var1 As Double
Dim var2 As Double
Dim var3 As Double
Var = 0
var1 = 0
var2 = 0
var3 = 0
While Not oRst2.EOF
On Error GoTo error
Dim san As Integer
For san = 0 To txtcampo1.Count - 1
txtcampo1(san).Text = oRst2.Fields("cod_insumo")
txt_aceptacio(san).Text = oRst2.Fields("aceptacion")
txt_consumo(san).Text = oRst2.Fields("consumo")
txt_consumotatal(san).Text = Str(txt_consumo(san).Text) * Str(txt_canti.Text)
txt_inv_PNDE(san).Text = oRst2.Fields("PNDE")
var3 = Str(txt_inv_PNDE(san).Text) - Str(txt_consumotatal(san).Text)
If var3 < 0 Then
txt_newinve(san).Text = 0
Else
txt_newinve(san).Text = var3
End If
var1 = Str(txt_newinve(san).Text)
var2 = Str(txt_consumotatal(san).Text)
Var = var1 + var2
newinvePNDE2(san).Text = Var
fecha(san).Text = oRst2.Fields("fecha")
oRst2.MoveNext
Next san
Exit Sub
error:
Wend
End With
oRst2.Close
Set oRst2 = Nothing
End Sub
1 respuesta
Respuesta de Roberto Alvarado
1
