Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS access new variable in the same query? 1

Status
Not open for further replies.

SeeWard

Programmer
Mar 21, 2005
89
US
Hello everyone,
How would I compare a newly created variable field against an existing field within the same query? Is to ask if one can create a variable in the query and reference it in that same query.
TIA
 
Sure, but you can't reference it by the "name" you gave it:


This will work:

SELECT Sum(SomeField) As Total FROM tblName WHERE SomeOtherField < Sum(SomeField)

but this won't
SELECT Sum(SomeField) As Total FROM tblName WHERE SomeOtherField < Total


Leslie

In times of universal deceit, telling the truth will be a revolutionary act. - George Orwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top