Wrox Programmer Forums
|
BOOK: Beginning Access 2007 VBA ISBN: 978-0-470-04684-5
This is the forum to discuss the Wrox book Beginning Access 2007 VBA by Denise M. Gosnell; ISBN: 9780470046845
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access 2007 VBA ISBN: 978-0-470-04684-5 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 August 1st, 2008, 10:44 PM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code Error Chapter 5

In chapter 5 pg. 167, the code reads:
'move to the next record in the local record since the
'current one is being deleted
If Not rsContacts.EOF Then
   rsContacts.MoveNext
  'save the id of the current (next) record
  intCurContact = rsContacts!intContactId
End If

but if you delete the last record in the recordset you get and error:
Runtime Error: 3021
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

Any idea on how to correct this.
Thanks
 
Old February 21st, 2009, 05:35 PM
Authorized User
 
Join Date: Jul 2008
Posts: 38
Thanks: 1
Thanked 2 Times in 2 Posts
Default

Again, this is an old post but I'll post an answer in hope of helping someone at a later date.

You can easily add an error handler and trap for error 3021 and then just exit the sub or function when you encounter it.
__________________
Thanks,

Bob Larson
Access MVP (2008-2010, 2011)
Free Access tutorials, samples, tools
 
Old July 23rd, 2010, 05:20 AM
Registered User
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 pg 167 - When Delete last record - crash

Quote:
Originally Posted by boblarson View Post
Again, this is an old post but I'll post an answer in hope of helping someone at a later date.

You can easily add an error handler and trap for error 3021 and then just exit the sub or function when you encounter it.
What the solution to add / change codes to prevent it crash - how to do it

If Not rsContacts.EOF Then
rsContacts.MoveNext
'save the id of the current (next)record
intCurContact = rsContacts!PCNumber
End If

error didplay: runtime error 3021 - either BOF or EOF is TRUE or the current has been deleted
 
Old January 30th, 2018, 04:31 PM
Authorized User
 
Join Date: Dec 2007
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default Runtime error - 91 - CH05 - Using UnboundContactForm

Hi, I was running the code using the example provided but I got this error.

See screen below, comparing with the code given is identical, I have to try to catch the error, but it doesn't have an idea what is going on.

Please provide some guidance.



Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 14 Code Error? pherank BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 4th, 2008 09:05 PM
Chapter 12 code error rsteph7 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 34 August 18th, 2004 01:53 PM
Chapter 6 p.171 Code Error bonehead BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 June 26th, 2004 05:28 PM





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