Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2004, 07:34 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default RecordCount Query returns EOF and BOF

HI,

I am firing query "SELECT COUNT(*) FROM EMPLOYEE" from Visual basic and populating recordset

rs.open "SELECT COUNT(*) FROM EMPLOYEE" , ConnectionObject

MSGBOX RS.FIELDS(0).VALUE --Here is gives me error

Error Code: 3021
Error Description: Either BOF or EOF is True or the current record has been deleted. Requested operation requires a current record

If I try to move the recordset to the first record, before fetching it, even it is giving me an error.

What could be the reason behind this? The same query runs on other PCs, but it throws an error on specific machine.

Please help me out



 
Old April 12th, 2004, 03:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you might want to issue a rs.MoveFirst statement before the MsgBox - see how that goes.

I am a loud man with a very large hat. This means I am in charge
 
Old November 6th, 2004, 12:49 PM
Aal Aal is offline
Authorized User
 
Join Date: Oct 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

rs.open "SELECT COUNT(*) AS QTT FROM EMPLOYEE" , ConnectionObject
if not ra.EOF then
   msgbox rs!QTT
end if

 
Old November 11th, 2004, 09:32 AM
Authorized User
 
Join Date: Oct 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Gaz LG Danha
Default

If all else fails, try creating a separate VARIABLE were you can save the value of RS.FIELDS(0).VALUE and the;
MSGBOX VARIABLE

It Ends Here





Similar Threads
Thread Thread Starter Forum Replies Last Post
"Either BOF or EOF is True" need help! murshed Classic ASP Databases 4 March 18th, 2008 03:43 PM
Random record from objRS - why is EOF or BOF True? jfrizelle Classic ASP Databases 0 February 5th, 2008 07:24 AM
Re-try - BOF-EOF error JpaulH Access VBA 2 May 4th, 2006 02:16 PM
Access to Excel - BOF or EOF error JpaulH Access VBA 1 May 3rd, 2006 04:30 PM
Either BOF or EOF is True, or the current record h gilgalbiblewheel Classic ASP Databases 3 March 9th, 2005 07:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.