0
這是我的代碼:VB6錯誤:運行時錯誤3021.BOF或EOF爲真或當前記錄已被刪除。請求的操作需要當前記錄
Dim c As Integer
Private Sub Command4_Click()
c = InputBox("ENTER STAFF ID")
Form6.Adodc1.Refresh
Form6.Adodc1.Recordset.MoveFirst `ERROR
While Form6.Adodc1.Recordset.EOF <> True
If Form6.Adodc1.Recordset.Fields(0) = Val(c) Then
Text1.Text = Form6.Adodc1.Recordset.Fields(0)
Text1.Enabled = False
Text2.Text = Form6.Adodc1.Recordset.Fields(1)
Text3.Text = Form6.Adodc1.Recordset.Fields(2)
Text4.Text = Form6.Adodc1.Recordset.Fields(5)
DTPicker2.Enabled = False
DTPicker1.Enabled = False
MsgBox "AFTER EDITING CLICK ON UPDATE"
Command2.Enabled = True
Exit Sub
Else
Form6.Adodc1.Recordset.MoveNext
End If
Wend
MsgBox "ENTER CORRECT STAFF ID"
End Sub
這是我在運行時收到錯誤:
VB6 Error: Runtime error 3021. Either BOF or EOF is true or the current record has been deleted. Requested operation requires a current record.
我已經在其他問題,我還沒收到在VB6中回答那些已解決的問題。我還提到了在點擊調試時出現錯誤的位置。 TIA
如果「Adodc1.Recordset」的來源沒有記錄,則BOF或EOF爲真。如果您提供了所有必要的信息來調試問題,那麼幫助會更容易一些。 –
@ C-PoundGuru:嗨,我是Stackoverflow的新手。我可否請你知道你在找什麼細節?所以我可以前進並分享。 –
那麼,你沒有顯示你的記錄源的來源。你有沒有做過任何調試以確認你有任何記錄? –