|
-
Oct 19th, 2008, 05:47 AM
#1
Thread Starter
New Member
Runtime Error:3021
whenever i try load the form which contains this code. i get the "runtime error '3021': Either BOF or EOF is true.... "
when i press "debug" button it shows the yellow highlight on "rs1.MoveFirst" line....
plz help me resolve this problem
Code:
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.ConnectionString = "dsn=sts;uid=system;pwd=ora92"
conn.Open
Set rs1 = New ADODB.Recordset
rs1.ActiveConnection = conn
rs1.Open " select specid from rule "
rs1.MoveFirst
While Not rs1.EOF
Combo1.AddItem rs1(0)
rs1.MoveNext
Wend
Adodc1.Visible = False
End Sub
Last edited by madhanacdc; Oct 19th, 2008 at 06:33 AM.
-
Oct 19th, 2008, 06:00 AM
#2
Re: Runtime Error:3021
it means no records have been found in that query
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 19th, 2008, 06:02 AM
#3
Thread Starter
New Member
Re: Runtime Error:3021
actually it does contain records...
but i dont know y i get that error
-
Oct 19th, 2008, 06:10 AM
#4
Re: Runtime Error:3021
how do you know it contains records? the error message indicates that no records have been returned, the table may have records, but the query has not returned them, try changing your query to test
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 19th, 2008, 06:15 AM
#5
Re: Runtime Error:3021
rs1.MoveFirst is unnecessary, just remove it...
-
Oct 19th, 2008, 06:32 AM
#6
Thread Starter
New Member
Re: Runtime Error:3021
thanks friends.... its working now.....
-
Oct 19th, 2008, 06:42 AM
#7
Re: Runtime Error:3021
Care to cite what actually solve your problem? Others may encounter the same scenario and your solution may benefit them...
-
Oct 19th, 2008, 06:47 AM
#8
Thread Starter
New Member
Re: Runtime Error:3021
i initially had records in the table, wht i did is, i deleted the table itself and created it again and populated with records. even then i was getting error during VB execution. so, i posted the problem here. meanwhile i once exited sql window and tried executing VB. at that time it worked. this is what happened....
thankq very much....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|