How can i select data to put into a report?

G

georgia_3010

i am making a report every week from the same database but dont want the data
i put into a report last week into the report for this week. I there anyway
i can select the data i want to put in?
 
A

akphidelt

There is multiple ways of doing this... you can use the DoCmd.OpenReport
Where statement... you can create a query linked to a table that has criteria
linked to a control on a form. So on the form you would have a date range...
like datestart and dateend.

In the query criteria you would put between Forms!yourform!datestart And
Forms!yourform!dateend
 
E

Evi

We'll call your date field WkDate
Create a query based on the same table as your report uses. In Design View
of the query, in the Criteria row, under your date field type

Between Date() And (Date()-7)

Name your query
QryLastWeeksData

Open your report in Design View
Click on Properties,
On the Data tab, next to Record Source, click the DownArrow and choose
QryLastWeeksData.
This will show the data for the last 7 days

If you want to show data for the current week even if the week hasn't
finished yet, in a new column in your query, in design view, type

WeekSt:
DateValue(Int(NZ([WkDate])))+1-DatePart("w",DateValue(Int(NZ([WkDate]))),2)

This gives you the date of the first Monday of the week in which the date
falls
In the criterial row under this put

DateValue(Int(NZ(Date())))+1-DatePart("w",DateValue(Int(NZ(Date()))),2)


Evi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top