Dim SQL As String SQL = "SELECT Articles.Code, Articles.Designation, Articles.Total As TotalA, " SQL = SQL + " ArticlesInventaire.Code, ArticlesInventaire.Designation, ArticlesInventaire.Total As TotalI " SQL = SQL + " FROM Articles, ArticlesInventaire "
MSFlexGrid.TextMatrix(I, 0) = DataR.Recordset!Code MSFlexGrid.TextMatrix(I, 1) = DataR.Recordset!Designation MSFlexGrid.TextMatrix(I, 2) = DataR.Recordset!TotalA MSFlexGrid.TextMatrix(I, 3) = DataR.Recordset!TotalI MSFlexGrid.TextMatrix(I, 4) = DataR.Recordset!Difference
Dim Difference as double Difference = DataR.Recordset!TotalA - DataR.Recordset!TotalI ' ... MSFlexGrid.TextMatrix(I, 4) = Difference
Dim SQL As String Dim I As Integer Dim Difference As Long SQL = " SELECT Articles.Code AS CodeA, Articles.Designation AS DesA, SUM(Articles.Total) AS TotalA, " SQL = SQL + " ArticlesInventaire.Code AS CodeI, ArticlesInventaire.Designation AS DesI, SUM(ArticlesInventaire.Total) AS TotalI" SQL = SQL + " From Articles, ArticlesInventaire " SQL SQL + " WHERE Articles.Code ArticlesInventaire.Code AND Articles.Designation = ArticlesInventaire.Designation " SQL = SQL + " GROUP BY Articles.Code, Articles.Designation, ArticlesInventaire.Code, ArticlesInventaire.Designation " DataR.DatabaseName = App.Path & "\BaseDonnee.mdb" DataR.RecordSource = SQL DataR.Refresh Difference = DataR.Recordset!TotalA - DataR.Recordset!TotalI If Not (DataR.Recordset.BOF And DataR.Recordset.EOF) Then DataR.Recordset.MoveLast DataR.Recordset.MoveFirst MSFlexGrid.Rows = DataR.Recordset.RecordCount + 1 I = 1 Do While Not DataR.Recordset.EOF MSFlexGrid.TextMatrix(I, 0) = DataR.Recordset!CodeA MSFlexGrid.TextMatrix(I, 1) = DataR.Recordset!DesA MSFlexGrid.TextMatrix(I, 2) = DataR.Recordset!TotalA MSFlexGrid.TextMatrix(I, 3) = DataR.Recordset!TotalI MSFlexGrid.TextMatrix(I, 4) = DataR.Recordset!Difference I = I + 1 DataR.Recordset.MoveNext Loop DataR.Refresh Else MSFlexGrid.Rows = 1 End If
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDifference = DataR.Recordset!TotalA - DataR.Recordset!TotalI If Not (DataR.Recordset.BOF And DataR.Recordset.EOF) Then DataR.Recordset.MoveLast DataR.Recordset.MoveFirst MSFlexGrid.Rows = DataR.Recordset.RecordCount + 1 I = 1 Do While Not DataR.Recordset.EOF MSFlexGrid.TextMatrix(I, 0) = DataR.Recordset!CodeA MSFlexGrid.TextMatrix(I, 1) = DataR.Recordset!DesA MSFlexGrid.TextMatrix(I, 2) = DataR.Recordset!TotalA MSFlexGrid.TextMatrix(I, 3) = DataR.Recordset!TotalI MSFlexGrid.TextMatrix(I, 4) = DataR.Recordset!Difference I = I + 1 DataR.Recordset.MoveNext Loop
If Not (DataR.Recordset.BOF And DataR.Recordset.EOF) Then DataR.Recordset.MoveLast DataR.Recordset.MoveFirst MSFlexGrid.Rows = DataR.Recordset.RecordCount + 1 I = 1 Do While Not DataR.Recordset.EOF MSFlexGrid.TextMatrix(I, 0) = DataR.Recordset!CodeA MSFlexGrid.TextMatrix(I, 1) = DataR.Recordset!DesA MSFlexGrid.TextMatrix(I, 2) = DataR.Recordset!TotalA MSFlexGrid.TextMatrix(I, 3) = DataR.Recordset!TotalI ' Récupérer les valeurs en cours Difference = DataR.Recordset!TotalA - DataR.Recordset!TotalI ' L'insérer dans le MSFlexGrid MSFlexGrid.TextMatrix(I, 4) = Difference I = I + 1 DataR.Recordset.MoveNext Loop