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 function

Status
Not open for further replies.

vb4me

Programmer
Nov 27, 2001
48
US
Hello,

I need help with a very simple thing - I am having a mental blank.

I have a table with a field that has a variety of dates. I have written a query that prompts you for start date and end date and it will select those records. Quite simple.

What I want to do is instead of being prompted for the start and end date I want to select the current months data.

So I was thinking month(now()) might do it as criteria but it returns nothing - what am I missing.

Any help will be appreciated.
 
Select WhateverFields From WhateverTable Where Month(YourdateField) = Month(Now);

Is it OK now?

[smile]

Dan
 
As criteria for a date field, you can employ the DateValue function
to drill down to a specific month & year.

Try adding this query in Northwind then, when prompted for
Enter mm/yyyy, respond with 10/1994.

Code:
PARAMETERS [enter mm/yyyy] Text;
SELECT Orders.OrderID, Orders.OrderDate
FROM Orders
WHERE (((Orders.OrderDate) Between DateValue([enter mm/yyyy]) And DateAdd("m",1,DateValue([enter mm/yyyy]))-1));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top