Results 1 to 8 of 8

Thread: Runtime Error:3021

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    12

    Resolved 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.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    12

    Re: Runtime Error:3021

    actually it does contain records...
    but i dont know y i get that error

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  5. #5
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Runtime Error:3021

    rs1.MoveFirst is unnecessary, just remove it...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    12

    Re: Runtime Error:3021

    thanks friends.... its working now.....

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Runtime Error:3021

    Care to cite what actually solve your problem? Others may encounter the same scenario and your solution may benefit them...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    12

    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
  •  



Click Here to Expand Forum to Full Width