Agregar elemeto con condicional VB Access
Publicado por Ucho03 (1 intervención) el 09/11/2009 20:18:18
Bien les cuento... Quisiera que ami treview se agregaran unos campos si se cumple una condicon, por algo que no se no lo gra dar con el code... Gracias de antemano
Dim txt As Control
For Each txt In Me.Controls
If TypeOf txt Is TextBox Then
Set txt.DataSource = rst
End If
Next
Text1.DataField = "nombre"
Text2.DataField = "rif"
Text3.DataField = "Objeto"
Call Cargar_Treeview
End Sub
Private Sub Cargar_Treeview()
Dim i As Long
Dim nodo As Node
rst.MoveFirst
With TreeView1.Nodes
.Clear
For i = 1 To rst.RecordCount
If rst.Fields("estatus") = "si" Then
Set nodo = .Add(, , , rst!nombre)
rst.MoveNext
End If
Next i
End With
rst.MoveFirst
End Sub
Private Sub Treeview1_NodeClick(ByVal Node As MSComctlLib.Node)
If flagNuevoRegistro = True Then
Exit Sub
End If
rst.MoveFirst
While Not rst.EOF And rst!nombre <> Node
rst.MoveNext
Wend
End Sub
Dim txt As Control
For Each txt In Me.Controls
If TypeOf txt Is TextBox Then
Set txt.DataSource = rst
End If
Next
Text1.DataField = "nombre"
Text2.DataField = "rif"
Text3.DataField = "Objeto"
Call Cargar_Treeview
End Sub
Private Sub Cargar_Treeview()
Dim i As Long
Dim nodo As Node
rst.MoveFirst
With TreeView1.Nodes
.Clear
For i = 1 To rst.RecordCount
If rst.Fields("estatus") = "si" Then
Set nodo = .Add(, , , rst!nombre)
rst.MoveNext
End If
Next i
End With
rst.MoveFirst
End Sub
Private Sub Treeview1_NodeClick(ByVal Node As MSComctlLib.Node)
If flagNuevoRegistro = True Then
Exit Sub
End If
rst.MoveFirst
While Not rst.EOF And rst!nombre <> Node
rst.MoveNext
Wend
End Sub
Valora esta pregunta
0