Function zagruz()
Dim bd As DAO.Database, tab1 As DAO.Recordset, tab2 As DAO.Recordset
Dim zap As DAO.Recordset
Dim kotch As Double, kpred As Double, kotg As Double
Dim str As Integer
Dim OKPO As Long
Set bd = CurrentDb()
Set tab1 = bd.OpenRecordset("Data_1")
Set tab2 = bd.OpenRecordset("data1")
Set zap = bd.OpenRecordset ("SELECT Data_1.окпо, Data_1.№стр, Data_1.Тек, Data_1.Пред, Data_1.Прош
FROM Data_1 INNER JOIN data1 ON (Data_1.№стр = data1.№стр) AND (Data_1.окпо = data1.ОКПО);")
Do Until zap.EOF
If Forms![Форма1]!ПолеСоСписком0 = 2 Then ' февраль
tab2.Edit
tab2![m5] = zap.Fields("Тек")
tab2![m105] = zap.Fields("Пред")
tab2![m205] = zap.Fields("Прош г")
tab2.Update
zap.MoveNext
tab2.MoveNext
End If
Loop
End Function
|