27/05/2004, 19:46
|
| | Fecha de Ingreso: mayo-2004
Mensajes: 14
Antigüedad: 20 años, 8 meses Puntos: 0 | |
mshflexgrid y una consulta sql que no funciona hola tengo que llenar un mshflexgrid con el resultado de un recorset pero la consulta sql me esta marcando un error espero puedan ayudarme aqui les dejo el codigo:
Dim conexion As ADODB.Connection: Set conexion = New ADODB.Connection
Dim recorset As ADODB.Recordset: Set recorset = New ADODB.Recordset
Me.MSHFlexGrid1.Visible = True
With conexion
.Provider = "MSDataShape.1"
.ConnectionString = "Data Source=" & "C:\carpeta\db.mdb;" _
& "Data Provider=Microsoft.Jet.OLEDB.4.0;"
.Open
With recorset
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
End With
Set recorset = .Execute("SHAPE {SELECT fecha As FECHA , id_num as NºUSUARIO, nombre as NOMBRE ,tomadas as TOMADAS,restantes as RESTANTES FROM clases where fecha='" & cdate(me.text4.text) & "'}")
End With
Set Me.MSHFlexGrid1.DataSource = recorset
Me.MSHFlexGrid1.ColWidth(0, 0) = 0
Me.MSHFlexGrid1.ColWidth(1, 0) = 1500
Me.MSHFlexGrid1.ColWidth(2, 0) = 1500
Me.MSHFlexGrid1.ColWidth(3, 0) = 2000
Me.MSHFlexGrid1.ColWidth(4, 0) = 1500
Me.MSHFlexGrid1.ColWidth(5, 0) = 1500
Me.MSHFlexGrid1.ColAlignment(1) = 3
Me.MSHFlexGrid1.ColAlignment(2) = 3
Me.MSHFlexGrid1.ColAlignment(3) = 3
Me.MSHFlexGrid1.ColAlignment(4) = 3
Me.MSHFlexGrid1.ColAlignment(5) = 3
Me.MSHFlexGrid1.ColAlignmentHeader(0, 3) = 3
End Sub |