Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3
This is the forum to discuss the Wrox book Access 2007 VBA Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Armen Stein; ISBN: 9780470047033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 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 October 28th, 2010, 12:39 PM
Registered User
 
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in Chapter 8

On page 247, the authors (or more likely, the single author of the chapter--I can't imagine that all of them would get this wrong), make a serious error in describing VBA's handling of If tests. They state:

"In fact, in Access VBA any value other than -1 is false, so the value 2 is always false."

This is precisely the opposite of the case. It's correct that testing the value of True will yield -1, but it is much more significant that the value of False is 0. Anything that evaluates to non-zero is treaed as "not False", and therefore True. Try this:

Code:
Sub bar()

    If 2 Then
        Debug.Print "Not False"
    Else
        Debug.Print "Not True"
    End If
    
End Sub
The result that's printed is "Not False".

So the problem with the "horrible example" code is that the "interesting code" will always run, regardless of the value of intOrderStatus, not that it won't run when intOrderStatus is 2.

I'm glad I didn't see this in the bookstore, or I might have left the book behind as "not trustworthy". It's been a big help in other ways.... As an aside that might help one to remember that "not False" takes precedence over "not True", the reason for the value of True is that the literal, bitwise "Not" of the value Integer 0 is the Integer value -1 (stored, as all negative values, as a 2's complement).
 
Old January 26th, 2011, 12:11 PM
gjgriffith's Avatar
Wrox Author
Points: 517, Level: 8
Points: 517, Level: 8 Points: 517, Level: 8 Points: 517, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2009
Location: Boulder, CO
Posts: 110
Thanks: 5
Thanked 14 Times in 14 Posts
Default Thank You!

Hello Roland,

Thank you for the kind comments about the Access 2007 VBA Programmer's Reference and that the book has helped you. More importantly, thank you for pointing out this error in Chapter 8. I appreciate your time and effort to report this problem and I hope it has not caused you any inconvenience.

It is extremely unfortunate that this text made it into the book and I have added it to the Errata items. Really, this text should have said "Any value other than 0 evaluates to True in VBA." And, I want to let you know that this problem was fixed in the subsequent Access 2010 Programmer's Reference book.

Anyway, thank you again for your note here and please let us know if you find any other errors in the book. We, and all of the other readers out there, really appreciate your efforts here!

Thanks,

Geoffrey L. Griffith
Co-Author for the Access 2007 VBA Programmer's Reference
http://www.ImagineThought.com

Last edited by gjgriffith; January 31st, 2011 at 01:51 PM..
 
Old January 31st, 2011, 06:50 PM
Registered User
 
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default You're Welcome.

Title just about says it all. Book continues useful.
 
Old February 28th, 2011, 08:45 AM
gjgriffith's Avatar
Wrox Author
Points: 517, Level: 8
Points: 517, Level: 8 Points: 517, Level: 8 Points: 517, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2009
Location: Boulder, CO
Posts: 110
Thanks: 5
Thanked 14 Times in 14 Posts
Default Thanks Again!

Hello RolandTumble,

Thanks for your follow up, I'm glad to hear that the Access 2007 VBA Programmer's Reference book has continued to be helpful for you. Please feel free to let us know if you have any more questions or comments, we always love to hear from our readers!

Thanks again,

Geoffrey L. Griffith
http://www.ImagineThought.com

Wrox Author of:
Access 2010 24-Hour Trainer
Access 2010 Programmer's Reference
Access 2007 VBA Programmer's Reference




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 error enderandpeter BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 January 27th, 2010 07:30 PM
error with chapter 7 jdz66 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 August 21st, 2006 05:19 PM
Parse error in error handler (Chapter 8) Funky Monk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 August 6th, 2004 08:59 AM





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