Connecting Tech Pros Worldwide Forums | Help | Site Map

error 3021

Newbie
 
Join Date: Nov 2009
Posts: 1
#1: 3 Weeks Ago
Dear Teacher,

I wrote program like below,

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub getdts()
  3. Dim ix, iy As Integer
  4. Dim tz, dz As String
  5. Dim V1A, V2A
  6. Dim V1B, V2B
  7. Dim V1C, V2C
  8. Dim nse, nso As Long
  9. Dim E_O As Boolean
  10.  tz = Format(tcp, "hh:mm:ss")
  11.  dz = Format(dcp, "dd-mm-yy")
  12.  E_O = IIf((Month(Date) Mod 2 = 0), True, False)
  13.  If E_O = True Then
  14.   If Rsi.EOF Then ShellRSe.AddNew
  15.  Else
  16.   ShellRSo.AddNew
  17.  End If
  18.  For ix = 1 To nr
  19.   DoEvents
  20.   Rsi.AbsolutePosition = ix
  21.   V1A = Rsi.Fields("DOWNA")
  22.   V2A = Rsi.Fields("RECDA")
  23.   V1B = Rsi.Fields("DOWNB")
  24.   V2B = Rsi.Fields("RECDB")
  25.   Form0.cmbLink.ListIndex = ix - 1
  26.   ap = ix
  27.   getdtAgilis
  28.   Do: DoEvents: Loop Until endp = True
  29.   If rtopA <> 0 Then
  30.    rtopA = rtopA - OfLvA(ix)
  31.    If V2A = "0" Then
  32.     Rsi.Fields("RECDA") = tz & "; " & dz: Rsi.Fields("DOWNA") = "0"
  33.    End If
  34.   Else
  35.    If V1A = "0" Then
  36.     Rsi.Fields("DOWNA") = tz & "; " & dz: Rsi.Fields("RECDA") = "0"
  37.    End If
  38.   End If
  39.   If rtopB <> 0 Then
  40.    rtopB = rtopB - OfLvB(ix)
  41.    If V2B = "0" Then
  42.     Rsi.Fields("RECDB") = tz & "; " & dz: Rsi.Fields("DOWNB") = "0"
  43.    End If
  44.   Else
  45.    If V1B = "0" Then
  46.     Rsi.Fields("DOWNB") = tz & "; " & dz: Rsi.Fields("RECDB") = "0"
  47.    End If
  48.   End If
  49.   Form0.txtsnA = Format(rtopA, "0.0")
  50.   Form0.txtsnB = Format(rtopB, "0.0")
  51.   If E_O = True Then
  52.    Delay (25)
  53.    ShellRSe.Fields("TIME") = tz               '<-------- sel A
  54.    ShellRSe.Fields("DATE") = dz
  55.    ShellRSe.Fields(1 + ix * 2) = rtopA
  56.    ShellRSe.Fields(2 + ix * 2) = rtopB
  57.   Else
  58.    Delay (25)
  59.    ShellRSo.Fields("TIME") = tz              '<-------- sel B
  60.    ShellRSo.Fields("DATE") = dz
  61.    ShellRSo.Fields(1 + ix * 2) = rtopA
  62.    ShellRSo.Fields(2 + ix * 2) = rtopB
  63.   End If
  64.   If rtds = ix Then Form3.rtdsp
  65.   endp = False
  66.   Delay (dl3)
  67.   Rsi.Update
  68.  Next ix
  69.  If E_O = True Then
  70.   ShellRSe.Update
  71.   ShellRSe.MoveNext
  72.  Else
  73.   ShellRSo.Update
  74.   ShellRSo.MoveNext
  75.  End If
  76. End Sub
  77.  
  78.  
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

Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: 1 Week Ago

re: error 3021


Would you mind stepping through in debug mode to see what you can find? Debug is located above your window, you probably already tried, just stating it in case not:-)

Thanks for posting your code by the way, it's nice!

L8ter!
Reply