1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
Private Sub form_current()
Dim DB As DAO.Database
Dim RecTabCible As DAO.Recordset
Dim CurRecQuery As DAO.Recordset
Dim avarRecords As Variant
Set DB = CurrentDb
Set CurRecQuery = DB.OpenRecordset("select * from selection")
avarRecords = CurRecQuery.GetRows(0)
Set RecTabCible = DB.OpenRecordset("graph1")
With RecTabCible
If RecTabCible.RecordCount <> 0 Then
CurRecQuery.MoveFirst
RecTabCible.Fields(0).Value = -1
RecTabCible.Fields(1).Value = avarRecords(16, 0)
RecTabCible.Fields(2).Value = avarRecords(20, 0)
RecTabCible.Fields(3).Value = avarRecords(21, 0)
CurRecQuery.MoveNext
RecTabCible.Fields(0).Value = 1
RecTabCible.Fields(1).Value = avarRecords(17, 0)
RecTabCible.Fields(2).Value = avarRecords(18, 0)
RecTabCible.Fields(3).Value = avarRecords(19, 0)
RecTabCible.Update
Else
RecTabCible.AddNew
RecTabCible.Fields(0).Value = -1
RecTabCible.Fields(1).Value = avarRecords(16, 0)
RecTabCible.Fields(2).Value = avarRecords(20, 0)
RecTabCible.Fields(3).Value = avarRecords(21, 0)
RecTabCible.Update
RecTabCible.AddNew
RecTabCible.Fields(0).Value = 1
RecTabCible.Fields(1).Value = avarRecords(17, 0)
RecTabCible.Fields(2).Value = avarRecords(18, 0)
RecTabCible.Fields(3).Value = avarRecords(19, 0)
RecTabCible.Update
End If
End With
Set RecTabCible = Nothing
Set CurRecQuery = Nothing
End Sub |
Partager