Hola a todos
Tengo un MSHFlexGrid que toma de una tabla de una Base de datos ciertos datos y cuando los muestra hay uno de ellos que es muy largo y trate de cambiarle el ancho a la columna del MSHFlexGrid pero no me deja, le puse MSHFlexGrid.ColWidth(2) = 300 y me dice que hay un error, luego en la ayuda encontre que solo puede ser 0 o -1 ese valor, 0 para hacerlo transparente, asi que no me queda otra opcion que -1 y no me sirve.
Asi que probe hacerlo con un MSFlexGrid y ahi si me lo hace como yo quiero, el problema es que me da un error cuando le quiero introducir los datos, el codigo que tengo es el siguiente:
Código:
Private datPrimaryRS As ADODB.Recordset
Private Sub Form_Load()
Dim sConnect As String
Dim sSQL As String
Dim dfwConn As ADODB.Connection
Dim i As Integer
Dim id As Integer
id = Val(Form12.DataList2.BoundText)
' establecer cadenas
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Password='';User ID=Admin;Data Source= C:\EXCHARSYS\Data\Data1.mdb;Mode=Share Deny None;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password='';Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False"
sSQL = "select Fecha_evento,Hora_evento,evento from Eventos where ID_Experimento="
sSQL = sSQL & id & ""
' abrir conexión
Set dfwConn = New ADODB.Connection
dfwConn.Open sConnect
Set datPrimaryRS = New ADODB.Recordset
datPrimaryRS.CursorLocation = adUseClient
datPrimaryRS.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly
Set MSFlexGrid1.DataSource = datPrimaryRS [B][COLOR=Red]AQUI ESTA EL PROBLEMA
With MSFlexGrid1
.Redraw = False
' establecer anchos de columna de cuadrícula
.ColWidth(0) = 300
.ColWidth(1) = 300
.ColWidth(2) = 4000
.FormatString = "Hora Evento | Fecha Evento | Evento"
' establecer tipo de cuadrícula
.AllowBigSelection = True
.FillStyle = flexFillRepeat
.ColAlignment(0) = flexAlignCenterCenter
.ColAlignment(1) = flexAlignCenterCenter
.ColAlignment(2) = flexAlignCenterCenter
' encabezado en negrita
.Row = 0
.Col = 0
.RowSel = .FixedRows - 1
.ColSel = .Cols - 1
.CellFontBold = True
' atenuar otra columna
For i = .FixedCols To .Cols() - 1 Step 2
.Col = i
.Row = .FixedRows
.RowSel = .Rows - 1
.CellBackColor = &HC0C0C0 ' gris claro
Next i
.AllowBigSelection = False
.FillStyle = flexFillSingle
.Redraw = True
End With
End Sub
Cuando llega a la parte MSFlexGrid1.DataSource = datPrimaryRS me da el siguiente error " Variable de tipo Object o la variable with no esta establecida"
Alguien sabe donde esta el error?
Saludos