Private Sub Form_Load()
  Adodc3.RecordSource = "select * from 用户信息表 where 操作员ID号"
  For i = 0 To Adodc3.Recordset.RecordCount
     If Adodc3.Recordset.BOF = True Then
        Exit For
     Else
       currentID = Adodc3.Recordset.Fields("操作员ID号").Value
       Adodc3.Recordset.MoveNext
       If Adodc2.Recordset.RecordCount <> Adodc3.Recordset.RecordCount Then
          Adodc2.Recordset.Fields("操作员ID号").Value = currentID
          Adodc2.Recordset.MoveNext
       Else
          Exit For
       End If
     End If
  Next i    
 End Sub
上面是我写的一段,请各位指出有那些语法错误和逻辑错误。
谢谢,因为有你,所以才有我的提高!!

解决方案 »

  1.   

    If Adodc3.Recordset.BOF = True Then
            Exit For应该为
    If Adodc3.Recordset.EOF = True Then
            Exit For 
    吧, 也可以不要
    直接写成For i = 0 To Adodc3.Recordset.RecordCount-1     
           currentID = Adodc3.Recordset.Fields("操作员ID号").Value
           Adodc3.Recordset.MoveNext
           If Adodc2.Recordset.RecordCount <> Adodc3.Recordset.RecordCount Then
              Adodc2.Recordset.Fields("操作员ID号").Value = currentID
              Adodc2.Recordset.MoveNext
           Else
              Exit For
           End If
         Adodc3.Recordset.movenext
      Next i    
      

  2.   

    For i = 0 To Adodc3.Recordset.RecordCount-1     
           currentID = Adodc3.Recordset.Fields("操作员ID号").Value
           'Adodc3.Recordset.MoveNext   这句下移
           If Adodc2.Recordset.RecordCount <> Adodc3.Recordset.RecordCount Then
              Adodc2.Recordset.Fields("操作员ID号").Value = currentID
              Adodc2.Recordset.MoveNext
           Else
              Exit For
           End If
         Adodc3.Recordset.movenext
      Next i
      

  3.   

    Private Sub Form_Load()
      Adodc3.RecordSource = "select * from 用户信息表 where 操作员ID号"  For i = 0 To Adodc3.Recordset.RecordCount
         If Adodc3.Recordset.BOF = True Then
            Exit For
         Else
           currentID = Adodc3.Recordset.Fields("操作员ID号").Value
           Adodc3.Recordset.MoveNext
           If Adodc2.Recordset.RecordCount <> Adodc3.Recordset.RecordCount Then
              Adodc2.Recordset.Fields("操作员ID号").Value = currentID
              Adodc2.Recordset.MoveNext
           Else
              Exit For
           End If
         End If
      Next i    
     End Sub
      

  4.   

    select * from 用户信息表 where 操作员ID号
    這一句就錯了。下面的我就沒看下去了。
      

  5.   

    可在 For i = 0 To Adodc3.Recordset.RecordCount - 1出现了对象变量或with块变量未设置。这是是什么原因啊?我不知道我哪里设置错了,
      

  6.   

    不用for 啦,用do ,do until rs.eof
      

  7.   

    vansoft(Vansoft Workroom) 你好,我刚学,谢谢能指出我的缺点,希望能帮忙改正我的缺点