I need to be able to print the results from the following MSHFlexGrid. Read on...
Here's the actual code:
How do I go from there. I've added a menu to the form and created a small menu structure that would include printing options.Code:Option Explicit Private Const MARGIN_SIZE = 60 ' en Twips 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 ' définir les chaînes sConnect = "Provider=MSDASQL.1;Extended Properties='DSN=Concorde;Description=Projet Concorde;UID=;PWD=;APP=Visual Basic;WSID=IAGQ0040;DATABASE=Concorde;Network=DBMSSOCN;Address=iagsrvsql,1433;Trusted_Connection=Yes'" ' ' La chaine strChaineSQL provient de frmNbQtCn1 ' sSQL = strChaineSQL & " ORDER by TypeLot" ' ouvrir la connexion Set dfwConn = New Connection dfwConn.Open sConnect ' créer un jeu d'enregistrements à partir de la collection fournie Set datPrimaryRS = New Recordset datPrimaryRS.CursorLocation = adUseClient datPrimaryRS.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly If datPrimaryRS.RecordCount > 0 Then Set MSHFlexGrid1.DataSource = datPrimaryRS With MSHFlexGrid1 .Redraw = False .TextMatrix(0, 0) = "Type" .TextMatrix(0, 1) = "Année" .TextMatrix(0, 2) = "Mois" .TextMatrix(0, 3) = "Sem." .TextMatrix(0, 4) = "Cie" .TextMatrix(0, 5) = "Produit" .TextMatrix(0, 6) = "N°Police" .TextMatrix(0, 7) = "Tran. sys." .TextMatrix(0, 8) = "Eff. Police" .TextMatrix(0, 9) = "Prime" .TextMatrix(0, 10) = "Agent" .ColWidth(0) = 500 .ColWidth(1) = 650 .ColWidth(2) = 500 .ColWidth(3) = 500 .ColWidth(4) = 450 .ColWidth(5) = 700 .ColWidth(6) = -1 .ColWidth(7) = 1110 .ColWidth(8) = 1110 .ColWidth(9) = -1 .ColWidth(10) = 0 For i = 0 To .Cols - 1 .MergeCol(i) = True Next i .Sort = flexSortGenericAscending .AllowBigSelection = True .FillStyle = flexFillRepeat .Row = 0 .Col = 0 .RowSel = .FixedRows - 1 .ColSel = .Cols - 1 .CellFontBold = True For i = .FixedCols To .Cols() - 1 Step 2 .Col = i .Row = .FixedRows .RowSel = .rows - 1 .CellBackColor = &HC0C0C0 ' gris clair Next i .AllowBigSelection = False .FillStyle = flexFillSingle .Redraw = True bolOkCharge = True End With Else MsgBox "There is no data to view." & vbCrLf + vbCrLf & "Select another agent", vbExclamation bolOkCharge = False End If End Sub
How do I add this feature from what's available here. I like the formating provided by MSHFlexGrid.
I've been searching for a few hours and I now give up. I need your help.
TIA





Reply With Quote