Dear Teacher,
I wrote program like below,
-
-
Sub getdts()
-
Dim ix, iy As Integer
-
Dim tz, dz As String
-
Dim V1A, V2A
-
Dim V1B, V2B
-
Dim V1C, V2C
-
Dim nse, nso As Long
-
Dim E_O As Boolean
-
tz = Format(tcp, "hh:mm:ss")
-
dz = Format(dcp, "dd-mm-yy")
-
E_O = IIf((Month(Date) Mod 2 = 0), True, False)
-
If E_O = True Then
-
If Rsi.EOF Then ShellRSe.AddNew
-
Else
-
ShellRSo.AddNew
-
End If
-
For ix = 1 To nr
-
DoEvents
-
Rsi.AbsolutePosition = ix
-
V1A = Rsi.Fields("DOWNA")
-
V2A = Rsi.Fields("RECDA")
-
V1B = Rsi.Fields("DOWNB")
-
V2B = Rsi.Fields("RECDB")
-
Form0.cmbLink.ListIndex = ix - 1
-
ap = ix
-
getdtAgilis
-
Do: DoEvents: Loop Until endp = True
-
If rtopA <> 0 Then
-
rtopA = rtopA - OfLvA(ix)
-
If V2A = "0" Then
-
Rsi.Fields("RECDA") = tz & "; " & dz: Rsi.Fields("DOWNA") = "0"
-
End If
-
Else
-
If V1A = "0" Then
-
Rsi.Fields("DOWNA") = tz & "; " & dz: Rsi.Fields("RECDA") = "0"
-
End If
-
End If
-
If rtopB <> 0 Then
-
rtopB = rtopB - OfLvB(ix)
-
If V2B = "0" Then
-
Rsi.Fields("RECDB") = tz & "; " & dz: Rsi.Fields("DOWNB") = "0"
-
End If
-
Else
-
If V1B = "0" Then
-
Rsi.Fields("DOWNB") = tz & "; " & dz: Rsi.Fields("RECDB") = "0"
-
End If
-
End If
-
Form0.txtsnA = Format(rtopA, "0.0")
-
Form0.txtsnB = Format(rtopB, "0.0")
-
If E_O = True Then
-
Delay (25)
-
ShellRSe.Fields("TIME") = tz '<-------- sel A
-
ShellRSe.Fields("DATE") = dz
-
ShellRSe.Fields(1 + ix * 2) = rtopA
-
ShellRSe.Fields(2 + ix * 2) = rtopB
-
Else
-
Delay (25)
-
ShellRSo.Fields("TIME") = tz '<-------- sel B
-
ShellRSo.Fields("DATE") = dz
-
ShellRSo.Fields(1 + ix * 2) = rtopA
-
ShellRSo.Fields(2 + ix * 2) = rtopB
-
End If
-
If rtds = ix Then Form3.rtdsp
-
endp = False
-
Delay (dl3)
-
Rsi.Update
-
Next ix
-
If E_O = True Then
-
ShellRSe.Update
-
ShellRSe.MoveNext
-
Else
-
ShellRSo.Update
-
ShellRSo.MoveNext
-
End If
-
End Sub
-
-
The problem is
sometime error 3021 will appear, I suspect addnew didn't take effek for instruction sel A aor sel B, I need brightness idea from you.
Thanks