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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date comparison in SQL function

Status
Not open for further replies.

davidmulcair

Programmer
Jun 26, 2001
35
CA
Here's a snippet:

SELECT tblLoans.LoanNum,
tblLoans.UserNum,
tblUsers.FirstName,
tblUsers.LastName,
tblLoans.LoanStatusCode,
tblLoans.LoanIssueDate,
tblLoans.LoanDueDate
FROM tblUsers INNER JOIN tblLoans ON tblUsers.UserNum = tblLoans.UserNum;

I want to add a WHERE clause to specify all of the "Loans" that are past the due date. I don't know how to get Access to retreive today's date in order to do this comparison.

Help please.

David Mulcair
 
You can use the function Now() to return the present Date/Time for comparison. So your criteria would be something like
WHERE tblLoans.DueDate < Now()

Hope that's what you're looking for
 

Use the Date() function.

SELECT tblLoans.LoanNum,
tblLoans.UserNum,
tblUsers.FirstName,
tblUsers.LastName,
tblLoans.LoanStatusCode,
tblLoans.LoanIssueDate,
tblLoans.LoanDueDate
FROM tblUsers INNER JOIN tblLoans ON tblUsers.UserNum = tblLoans.UserNum;
WHERE tblLoans.LoanDueDate<date(); Terry Broadbent
Please review faq183-874.

&quot;The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge.&quot; - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top