Visual Basic - FILTROS Y BUSQUEDAS

Life is soft - evento anual de software empresarial
 
Vista:

FILTROS Y BUSQUEDAS

Publicado por AGET (3 intervenciones) el 15/02/2006 16:16:14
TENGO 2 TABLAS Y NECESITO A PARTIR DE UNA DE ELLAS TOMAR EL CODIGO DEL PRODUCTO Y BUSCARLO EN LA 2DA TABLA PARA AGRUPAR TODOS LOS QUE TENGAN IGUAL CODIGO Y LUEGO MOSTRARLO EN UN DATA GRID O UN MSFLEXGRID O ALGO SIMILAR, GRACIAS
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

RE:FILTROS Y BUSQUEDAS

Publicado por wladimir (54 intervenciones) el 15/02/2006 16:53:07
Dim SqlString As String
Dim ConODBC As ADODB.Connection
Dim Rs1 As ADODB.Recordset
SqlString=select * from tabla1,tabla2 where tabla1.codigo=tabla2.codigo
Rs1.Source = SqlString
Rs1.Open
If Rs1.EOF = True Then
MsgBox "NO HAY REGISTROS..!!", vbInformation, "SIN REGISTROS"
Exit Sub
End If
' esto ed para un flegrid

Grid_datos.ForeColorFixed = vbWhite
Grid_datos.ForeColor = QBColor(1)
Grid_datos.Row = 0
Grid_datos.Col = 0: Grid_datos = "nombre del camo1"
Grid_datos.Col = 1: Grid_datos = "nombre del camo2"
Grid_datos.Col = 2: Grid_datos = "nombre del camo3"
' el ancho del, campo

Grid_datos.ColWidth(0) = 1200
Grid_datos.ColWidth(1) = 700
Grid_datos.ColWidth(2) = 1000

Rs1.MoveFirst

Do While Not Rs1.EOF
' aqui ingresa los dataos de la tabla 1 o 2 que quieres que te muestre

Grid_datos.Rows = Grid_datos.Rows + 1
Grid_datos.Row = Grid_datos.Rows - 1

Grid_datos.Col = 0
Grid_datos = Rs1!nomnbre_del_dato_de la tabla

Grid_datos.Col = 1
Grid_datos = Rs1!nomnbre_del_dato_de la tabla

Grid_datos.Col = 2
Grid_datos = Rs1!nomnbre_del_dato_de la tabla



Rs1.MoveNext

Loop
Rs1.MoveFirst
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar