- Joined
- Feb 12, 2007
- Messages
- 2
- Reaction score
- 0
hello i am new in forum
i am trying this code in visual basic 6 and i am getting error 3021
wich says either bof either eof is true or current record has deleted.
The function requires a current record. Could anyone help me please?
my code is:
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=MSDASQL.1;" & _
"Data Source=mydb;" & _
"Persist Security Info=False;" & _
"Data Source=mydb.mdb;Initial Catalog=C:\Program Files\Microsoft Visual Studio\VB98\ergasia\mydb"
conn.Open
sql = "select * from orders"
Set rs = New ADODB.Recordset
rs.Open sql, conn, adOpenStatic, adLockOptimistic
For i = 0 To FuncTxt.UBound
Set FuncTxt(i).DataSource = rs
Next i
FuncTxt(0).DataField = "ShipName"
FuncTxt(1).DataField = "ShipAddress"
FuncTxt(2).DataField = "ShipCity"
FuncTxt(3).DataField = "ShipPostCode"
FuncTxt(4).DataField = "ShipCountry"
FuncTxt(5).DataField = "custAFM"
FuncTxt(6).DataField = "OrderID"
rs.MoveFirst
end sub
Private Sub nextCmd_Click()
If rs.AbsolutePosition < rs.RecordCount Then
rs.MoveNext
End If
End Sub
when i am clicking in the next button it goes to the next record but when the last record appears if i click nextCmd then the contents of textboxes is "" and then if i click again the nextCmd button occurs the runtime erro 3021 i refered previous.
i am trying this code in visual basic 6 and i am getting error 3021
wich says either bof either eof is true or current record has deleted.
The function requires a current record. Could anyone help me please?
my code is:
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=MSDASQL.1;" & _
"Data Source=mydb;" & _
"Persist Security Info=False;" & _
"Data Source=mydb.mdb;Initial Catalog=C:\Program Files\Microsoft Visual Studio\VB98\ergasia\mydb"
conn.Open
sql = "select * from orders"
Set rs = New ADODB.Recordset
rs.Open sql, conn, adOpenStatic, adLockOptimistic
For i = 0 To FuncTxt.UBound
Set FuncTxt(i).DataSource = rs
Next i
FuncTxt(0).DataField = "ShipName"
FuncTxt(1).DataField = "ShipAddress"
FuncTxt(2).DataField = "ShipCity"
FuncTxt(3).DataField = "ShipPostCode"
FuncTxt(4).DataField = "ShipCountry"
FuncTxt(5).DataField = "custAFM"
FuncTxt(6).DataField = "OrderID"
rs.MoveFirst
end sub
Private Sub nextCmd_Click()
If rs.AbsolutePosition < rs.RecordCount Then
rs.MoveNext
End If
End Sub
when i am clicking in the next button it goes to the next record but when the last record appears if i click nextCmd then the contents of textboxes is "" and then if i click again the nextCmd button occurs the runtime erro 3021 i refered previous.