Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Timer()
Dim res As Recordset, res2 As Recordset, a As Long
a = 0
Me.two = 0
restart:
err.Clear
On Error Resume Next
Sleep (a)
Set res = CurrentDb.OpenRecordset("ZakN", , dbDenyRead, 2) 'dbDenyRead
Me.two = Me.two + 1
Me.Repaint
With res
If res.RecordCount = 0 Then
.AddNew
res("№_заказа") = 1
Else
.Edit
res("№_заказа") = IIf(res("№_заказа") = "" Or IsNull(res("№_заказа")), 1, res("№_заказа") + 1)
End If
Me.one.Value = res("№_заказа")
.Update
End With
a = Mid(Timer, 6, 3)
If err.number <> 0 Then Resume restart
res.Close
a = 0
restart1:
err.Clear
On Error Resume Next
Sleep (a)
Set res2 = CurrentDb.OpenRecordset("TF_ADDress", , dbAppendOnly, 2)
With res2
.AddNew
!аддрес = Me.one
.Update
End With
a = Mid(Timer, 6, 3)
If err.number <> 0 Then Resume restart1
res2.Close
If Me.one > 10500 Then Me.TimerInterval = 0
End Sub
|