Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    5

    ADO Runtime error # 3021

    I'm using Visual Basic 6.0 Enterprsise Edition
    I have Two queries TankerExpQuery and TankerExpTotalQuery in Access 2000 database both queries both are built from the Invoice table and are joined with invdate

    the fiels in TankerExpTotalQuery are Grouped By InvDate

    The description of query is

    sqlQuery = "SELECT TankerExpQuery.TankerNo, TankerExpQuery.BalDue, TankerExpQuery.InvNo, TankerExpQuery.InvDate, TankerExpQuery.StCity, TankerExpQuery.DestCity, TankerExpQuery.ProdName, TankerExpQuery.Quantity, TankerExpQuery.Amount, TankerExpQuery.ShtQty, TankerExpQuery.ShtAmt, TankerExpQuery.Exp, TankerExpQuery.Reason, TankerExpTotalQuery.SumOfAmount, TankerExpTotalQuery.SumOfCom, TankerExpTotalQuery.SumOfShtAmt, TankerExpTotalQuery.SumOfExp " & _
    "FROM TankerExpTotalQuery INNER JOIN TankerExpQuery ON TankerExpTotalQuery.InvDate = TankerExpQuery.InvDate " & _
    "WHERE (TankerExpQuery.TankerNo = '" & ComTankerNo.Text & "') AND (TankerExpQuery.InvDate Between #" & txtFrom.Text & "# And #" & txtTo.Text & "#) " & _
    "ORDER BY TankerExpQuery.InvNo;"

    rst.Open sqlQuery, cnn, adOpenKeyset, adLockPessimistic

    When i used rst.Fields(0).Name
    It gives me a field name but if i use
    rst.MoveNext
    it gives me a error message
    Rum-time error '3021'
    Either BOF or EOF is true, or the current record has been deleted;
    the operation requested by the application requires a current record;

    When i run this query in Access 2000 it works fine.
    If I check MsgBox rst.EOF and MsgBox rst.BOF both messages shows me true

    If someone has any idea about this error i would really appreciate it
    thanks in advance.

  2. #2
    Join Date
    Sep 2003
    Posts
    8
    Your SQL query returned 0 records. Its a valid query so you can access the recordset's Fields collection but there are no records to move to in the rs.MoveNext command.

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    Either no records are returned or 1 record is returned. You need to check recordset.eof.

  4. #4
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    5
    Originally posted by mdhealy
    Your SQL query returned 0 records. Its a valid query so you can access the recordset's Fields collection but there are no records to move to in the rs.MoveNext command.

  5. #5
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    5
    How can i move in to the records if it is a valid sql query.

  6. #6
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    5
    I have checked rst.eof and rst.bof both shows me true

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •