nedd help with a query

J

John

hi everybody,

I'm new to access and I need to write a query that will retrieve all th
records that have been added to the database within the last month

thanks for your help
 
F

fredg

hi everybody,

I'm new to access and I need to write a query that will retrieve all th
records that have been added to the database within the last month

thanks for your help

Do you have a field in the table that contains the date the record was
added?


Create a new query.
In Query Design View, click on View + SQL
Copy and paste the below code into the Query SQL.

Change the table name and field name to what ever the actual names
are.

Does 'within the last month' mean 1 month from today's date?
Select TableName.* From TableName
Where TableName.DateField >= DateAdd("m",-1,Date())

Does 'within the last month' mean just from the 1st of the current
month?
Select TableName.* From TableName
Where Format(TableName.DateField),"mm/yyyy") =
Format(Date(),"mm/yyyy")
 
M

maurrieske

I hope that one of the fields in the table is a insert date. Then you can
make a query where all columns are added and in the the column with the date
tou insert in the criterium (dd-mm-yyyy notation in my dbase)
#1-7-2007# And <#1-8-2008#


Maurrieske
 
J

John

yes I have a date field in the table and yes 'within the last month' mean 1
month from today's date

what if I wanted to show everything that was added within the last 2 months

would look like thisa, right ?

Select * From table
Where table.Date >= DateAdd("m",-2,Date())

thanks for your help\\
 
F

fredg

yes I have a date field in the table and yes 'within the last month' mean 1
month from today's date

what if I wanted to show everything that was added within the last 2 months

would look like thisa, right ?

Select * From table
Where table.Date >= DateAdd("m",-2,Date())

thanks for your help\\

Yes.
 
Top