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
上面是我写的一段,请各位指出有那些语法错误和逻辑错误。
谢谢,因为有你,所以才有我的提高!!
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
上面是我写的一段,请各位指出有那些语法错误和逻辑错误。
谢谢,因为有你,所以才有我的提高!!
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
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
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
這一句就錯了。下面的我就沒看下去了。