Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference 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
  #1 (permalink)  
Old August 21st, 2004, 10:49 AM
Authorized User
 
Join Date: Jun 2004
Location: Cumberland, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Faulty Date Logic

Is the IF statement in the code at the top of p.292 correct?

The IF statement ...

If txtEndDate > txtStartDate Then
   'Alert the user and Cancel the update
   Cancel = MsgBox(Start Date must be before the End Date", _
     vbInformation, "Data Validation Failure")
End If

is used to validate that the Start Date is before the End Date (or conversely, that the End Date is after the Start Date). The dates would be invalid if the Start Date were GREATER THAN the End Date.

In order for the code to work correctly, shouldn't the IF statement be changed to ...

If txtStartDate > txtEndDate Then
   'Alert the user and Cancel the update
   Cancel = MsgBox(Start Date must be before the End Date", _
     vbInformation, "Data Validation Failure")
End If



Terry Waltz
__________________
Terry Waltz


Similar Threads
Thread Thread Starter Forum Replies Last Post
help to solve the logic pradeepn XSLT 4 May 22nd, 2007 06:07 AM
And/Or Logic??? ninel SQL Server 2000 2 February 9th, 2007 11:33 AM
Buggy and Faulty code in Vb sun21170 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 September 18th, 2006 08:59 PM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM





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