Ahi va el codigo
Publicado por Matias (136 intervenciones) el 07/08/2007 00:43:12
ACA TE MANDO EL CODIGO, USO VECTORES PORQUE TENGO TRES CAPAZ EN LA APLICACION ENTONCES ES LA UNICA MANERA QUE SE ME OCURRIO DE TRAER LOS DATOS !!!!
LOS (OBJCONTROL.) SON DATOS DE UNA CAPA INFERIOR QUE LSO PONGO EN VECTORES
MUCHAS GRACIAS
Dim cant As Integer
Dim i As Integer
Set objcontrol = New FILIALRN
objcontrol.INICIALIZAR_DATO
objcontrol.s_rcantidad
If objcontrol.s_rcontrol = "no entrar" Then
mensaje = "No hay socios cargados"
If MsgBox(mensaje, vbOKOnly + vbInformation, "Ningun socio") = vbOK Then
End If
Exit Sub
End If
Set rs = New ADODB.Recordset
' Define tres campos de tipo string
With rs.Fields
.Append "Codigo", adBSTR, 5
.Append "Sub Codigo", adBSTR, 5
.Append "Nombre", adBSTR, 10
.Append "Localidad", adBSTR, 25
.Append "Direccion", adBSTR, 40
End With
' Abre el recordset desconectado
rs.Open
' Agrega cinco registros
cant = objcontrol.s_rvcant
For i = 1 To cant
objcontrol.s_rvcant = i
objcontrol.nomloc
objcontrol.p_rnombre = objcontrol.s_rnombrelocalidad
rs.AddNew _
Array("Codigo", "Sub Codigo", "Nombre", "Direccion", "Localidad"), _
Array(objcontrol.s_rvcodigo, objcontrol.s_rvsubcodigo, objcontrol.s_vrnombre, objcontrol.s_vrdireccion, objcontrol.p_rnombre)
Next
Set DataGrid1.DataSource = rs
' establece un ancho a las columnas
With DataGrid1
.Columns(0).Width = 250
.Columns(1).Width = 2500
.Columns(2).Width = 3500
.Columns(3).Width = 5500
End With
' se mueve al primer registro
rs.MoveFirst
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
ver1
Exit Sub
End If
If Text1.Text = " " Then
mensaje = "El caractar a buscar no debe comenzar con un espacio"
If MsgBox(mensaje, vbOKOnly + vbInformation, "Caracter no valido") = vbOK Then
End If
Text1.SetFocus
ver1
Exit Sub
End If
If Text1 <> "" Then
rs.Filter = "Nombre" & " LIKE '*" + Text1.Text + "*'"
Set DataGrid1.DataSource = rs
With DataGrid1
.Columns(0).Width = 250
.Columns(1).Width = 3000
.Columns(2).Width = 3160
.Columns(3).Width = 1200
.Columns(4).Width = 1800
End With
End If
LOS (OBJCONTROL.) SON DATOS DE UNA CAPA INFERIOR QUE LSO PONGO EN VECTORES
MUCHAS GRACIAS
Dim cant As Integer
Dim i As Integer
Set objcontrol = New FILIALRN
objcontrol.INICIALIZAR_DATO
objcontrol.s_rcantidad
If objcontrol.s_rcontrol = "no entrar" Then
mensaje = "No hay socios cargados"
If MsgBox(mensaje, vbOKOnly + vbInformation, "Ningun socio") = vbOK Then
End If
Exit Sub
End If
Set rs = New ADODB.Recordset
' Define tres campos de tipo string
With rs.Fields
.Append "Codigo", adBSTR, 5
.Append "Sub Codigo", adBSTR, 5
.Append "Nombre", adBSTR, 10
.Append "Localidad", adBSTR, 25
.Append "Direccion", adBSTR, 40
End With
' Abre el recordset desconectado
rs.Open
' Agrega cinco registros
cant = objcontrol.s_rvcant
For i = 1 To cant
objcontrol.s_rvcant = i
objcontrol.nomloc
objcontrol.p_rnombre = objcontrol.s_rnombrelocalidad
rs.AddNew _
Array("Codigo", "Sub Codigo", "Nombre", "Direccion", "Localidad"), _
Array(objcontrol.s_rvcodigo, objcontrol.s_rvsubcodigo, objcontrol.s_vrnombre, objcontrol.s_vrdireccion, objcontrol.p_rnombre)
Next
Set DataGrid1.DataSource = rs
' establece un ancho a las columnas
With DataGrid1
.Columns(0).Width = 250
.Columns(1).Width = 2500
.Columns(2).Width = 3500
.Columns(3).Width = 5500
End With
' se mueve al primer registro
rs.MoveFirst
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
ver1
Exit Sub
End If
If Text1.Text = " " Then
mensaje = "El caractar a buscar no debe comenzar con un espacio"
If MsgBox(mensaje, vbOKOnly + vbInformation, "Caracter no valido") = vbOK Then
End If
Text1.SetFocus
ver1
Exit Sub
End If
If Text1 <> "" Then
rs.Filter = "Nombre" & " LIKE '*" + Text1.Text + "*'"
Set DataGrid1.DataSource = rs
With DataGrid1
.Columns(0).Width = 250
.Columns(1).Width = 3000
.Columns(2).Width = 3160
.Columns(3).Width = 1200
.Columns(4).Width = 1800
End With
End If
Valora esta pregunta


0