Please help me for the following program problem.
When I Click Next button, at the last record, it Shows --Run time error '3021': Either BOF or EOF......
When I Click Next button, at the last record, it Shows --Run time error '3021': Either BOF or EOF......
Code:
Option Explicit
Dim strsql As String
Dim con_data As ADODB.Connection
Dim rs_Data As ADODB.Recordset
Private Sub Form_Load()
Set con_data = New ADODB.Connection
Set rs_Data = New ADODB.Recordset
con_data.Provider = "Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\salary97.mdb"
con_data.Open
strsql = ("select * from employee")
rs_Data.Open strsql, con_data, adOpenDynamic, adLockOptimistic
End Sub
Private Sub cmdnext_Click()
If rs_Data.EOF Then
rs_Data.MoveLast
Else
rs_Data.MoveNext
End If
txtnm.Text = rs_Data!ename
End Sub
Comment