If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > ADO Runtime error # 3021

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-01-03, 15:13
zuik zuik is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 12-04-03, 07:35
mdhealy mdhealy is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 12-04-03, 22:13
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Either no records are returned or 1 record is returned. You need to check recordset.eof.
Reply With Quote
  #4 (permalink)  
Old 12-10-03, 17:31
zuik zuik is offline
Registered User
 
Join Date: Nov 2003
Location: Canada
Posts: 5
Quote:
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.
Reply With Quote
  #5 (permalink)  
Old 12-10-03, 17:36
zuik zuik is offline
Registered User
 
Join Date: Nov 2003
Location: Canada
Posts: 5
How can i move in to the records if it is a valid sql query.
Reply With Quote
  #6 (permalink)  
Old 12-10-03, 17:38
zuik zuik is offline
Registered User
 
Join Date: Nov 2003
Location: Canada
Posts: 5
I have checked rst.eof and rst.bof both shows me true
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On