date query

fadetoblack

Registered User.
Local time
Today, 06:08
Joined
Aug 26, 2006
Messages
16
Hi, I want to create a query that i can select a month from a list and display all data in my table from dates within this month. I have not had much luck doing this so far so any help would be much appreciated.

Ultimately I would like to have a report that when I open, ask me to select a date and and display the correct data. Could anyone help me with this please. I also want the data to be from the current year when the date is selected.

thank you very much
 
Do you mean something like:

SELECT *
FROM table (your table name goes here)
WHERE date = [date?]

Instead of actually "hard coding" the date, when you include it in the brackets, Access will ask you to specify the date you want.

This would start you going, I hope.
 
I'm not quite sure where to put that.

I'll try explaining again.

I have a set of data, which I want to produce a report of every month. The months report is of all the data with a date value within this month.

I want to open my report and it to give me a list box or msg box asking for the month required. When this is selected or typed in I want it to run a query with this value and produce a report of all the data within this month.

I think that makes a bit more sense.

thanks
 
fadetoblack said:
I'm not quite sure where to put that.

I'll try explaining again.

I have a set of data, which I want to produce a report of every month. The months report is of all the data with a date value within this month.

I want to open my report and it to give me a list box or msg box asking for the month required. When this is selected or typed in I want it to run a query with this value and produce a report of all the data within this month.

I think that makes a bit more sense.

thanks
You will need to take the query nikolasp gave you and put it in a procedure that gets called whenever you report gets opened. Your procedure should require a parameter to be passed to it which will be the date or year...etc.

I don't know the VBA code by heart, but it will worth searching for it.
Hope that helps
B
 
Create a query including all dates.
Save your query.
Create a report based on the query.

Now, create a form with either a list box including all months or with an unbound text box to enter a specific month.
Put a button on the form to open the report (follow the wizard).

Now, amend the On Click event of your button to add a condition to the Open Report method.
Referring to Access Help, search for the Open Report method.
Use the function DatePart in the condition to refer to the month part of the date in your table rows.

RV
 

Users who are viewing this thread

Back
Top Bottom