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

How can i extract data base on month?

Status
Not open for further replies.

myaccess2000

Technical User
Aug 4, 2002
16
0
0
SG
Hi

I would like to know what needs to fill in the criteria in the queries under the short data format named date in order to extract out monthly data. Is it possible to do so, just by allowing the user to input the month and it will process all the date with the month stated by the user?

Pls help.

Regards
irene
 
Try creating a new query a Northwind and copying/pasting the following SQL. When you run the query, you'll be 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));
 
In the field portion of the query date field, put:

Format([Name of Date Field], "mm")

Then, in the criteia box, place your paramater query asking for the month by number 01-12:

[Please Enter Month (01-12)]

The date field in the query will be displayed as a number 01 throguh 12 and the paramter query will match this and you are done.

Hope this helps. The secret to creativity is knowing how to hide your sources. - Albert Einstein [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top