473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Runtime Error: 3021

72
Hi there, can someone tell me what is wrong with my code am getting a run time error 3021:

Here my code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. If rs.State = adStateOpen Then rs.Close
  3.       rs.Open "Select * from [SUBJECTS] where ID like 'ABA0102%'", cnn, adOpenKeyset, adLockOptimistic
  4.  
  5.   While rs.EOF <> True
  6.     For x = 0 To 15
  7.  
  8.         txtSubjects(x).Text = rs.Fields("SUBJECT").Value
  9.         rs.MoveNext
  10.  
  11.     Next x
  12.  
  13.   Wend
  14.  
  15.  
Am getting the eror on this line
Expand|Select|Wrap|Line Numbers
  1.   txtSubjects(x).Text = rs.Fields("SUBJECT").Value
  2.  
Hope somebody can help me out here.
May 16 '07 #1
1 3498
Killer42
8,435 Expert 8TB
I'd guess you've moved past the end of the recordset. The test for EOF on the While loop is only checked when you reach the end of the While loop, to decide whether to go 'round again.

So you are saying something like...

"Am I at the end yet? No? Good, then grab the next 16 records."

Presumably, there were less than 16 records available.
May 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Colin Graham | last post by:
I am writing this piece of code to show the previous record on a control on the form but i keep getting the error message "Error 3021 no current record " and the line marked *** gets highlighted. I...
9
by: Robert Wing | last post by:
I support an MS Access application in which errors are trapped using the On Error statement. Just recently, the users of this system have experienced run-time error number 3021 on a random basis. ...
2
by: dixie | last post by:
Can someone please give me the error number for this error? dixie
2
by: Polly | last post by:
I'm trying to write the results of a query, a name, ID number, and date out to a notepad .txt file to print on a "legacy" printer. I get the output from the first 2 "write" lines over the...
0
by: Jamey | last post by:
I perused old posts for an answer to this for at least an hour, and I've found a work-around, but no definitive answer. Synopsis of the problem: On NotInList or ctl.Requery commands where a...
3
by: windandwaves | last post by:
Hi, I am trying to make errors a bit more meaningful for my users. I am trying to fix error 3201 where there is a missing field in a form. If I do not do any error trapping, then I get ...
2
by: Robert | last post by:
I have a label on my form lblCount and the following code in my form for displaying a record count: Private Sub Form_Current() Me.RecordsetClone.Bookmark = Me.Bookmark Me!lblCount.Caption =...
7
by: ruvi | last post by:
I am getting runtime error 3021 - Either EOF or BOF is true or the current record has been deleted..... I have 2 combo boxes in a form- One for the client and the other for the project. When the...
8
by: fish919 | last post by:
Hello All, I am having a little trouble with my database. The Database has a parent table with 5 or 6 children tables in it they are linked by a common id filed. The problem is that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.