Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > BOOK: Beginning SQL
|
BOOK: Beginning SQL
This is the forum to discuss the Wrox book Beginning SQL by Paul Wilton, John Colby; ISBN: 9780764577321
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning SQL 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 June 11th, 2007, 10:35 AM
Authorized User
 
Join Date: Jun 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comparing Two values from same table

Hello all,

I'm having a problem writing the last line for my where clause for my recordsource for access. I will omit the SELECT and FROM clauses because i know they work.

My where clause works up to this point:
Code:
" WHERE deceasedHolder.[Company ID] ='" & Me!Company_ID & "'" & _
    " AND deceasedHolder.[Next Put Date] = #" & Me!txtPutDate & "#" & _
The last "AND" should compare two values from the table deceasedHolder, which are deceasedHolder.[Quantity Approved] and deceasedHolder.Quantity, and return the fields where quantity approved is less than quantity. This is what I put down, but it is generating the error "You cancelled the previous operation.
Code:
    " AND deceasedHolder.[Quantity Approved] < deceasedHolder.Quantity;"
Any and all help is greatly appreciated.
Mark

 
Old September 18th, 2008, 06:47 PM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Try It With Aliases.

 
Old December 1st, 2009, 03:44 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default

you can use this syntax
WHERE deceasedHolder.[Company ID] =@mycompanyID AND AND deceasedHolder.[Next Put Date] = @putDate AND deceasedHolder.[Quantity Approved] < deceasedHolder.Quantity;

and define this variables
define @mycompanyID varchar(20)
define @putDate datetime

set @mycompanyID = Me!Company_ID
set @putDate = Me!txtPutDate
 
Old December 11th, 2009, 07:35 AM
Registered User
 
Join Date: Dec 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank u to every member of this thread. My question is as a beginner in programming, what do l need to understand the programming codes?l have not understand those programming codes and how they are used.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing values between different MSHFlexGrid davekrunal46 Visual Basic 2005 Basics 0 November 28th, 2005 07:42 AM
Comparing values between different MSHFlexGrid davekrunal46 VB How-To 0 November 28th, 2005 07:41 AM
Comparing values between different MSHFlexGrid davekrunal46 VB Databases Basics 0 November 28th, 2005 07:39 AM
Comparing values between different MSHFlexGrid davekrunal46 Beginning VB 6 0 November 28th, 2005 07:38 AM
Comparing values between different MSHFlexGrid Con davekrunal46 Pro VB Databases 0 November 28th, 2005 07:36 AM





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