Problem with query criteria

bibstar03

New Member
Joined
Jan 30, 2003
Messages
25
I am doing a database which contains data dated in the past. I need criteria which will open a query and show data for the last month.

E.g. on the 28feb i want to open a query which shows the data from the 1st feb - today, if possible i do not want the user to have to type in any dates.

Thanks for any help
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
use
>=DateSerial(Year(Date()),Month(Date()),1)
as the criteria for the date field in your query

HTH

Peter
 
Upvote 0
You have to use your own date field name.

>=DateSerial(Year([YourDateFieldName]),Month([YourDateFieldName]),1)
 
Upvote 0
Sorry, the criteria should be

>=DateSerial(Year(Date()),Month([YourDateFieldName]),1)

David
 
Upvote 0
Nope, my formula gives the first of the current month, so entering it now should give you all of the records from Jan 1 2004
In what way did it not work? what results did you get?

did you actualy want data for the current month or for last month?

Peter
 
Upvote 0
No that criteria doesn't work, maybe i'm entering it in wrong, i'm what you could call a newbe. The criteria im entering just brings up all the dates????

thanks again

Bibstar
 
Upvote 0
If you could post the SQL from the query we can see if we can spot something.

Peter
 
Upvote 0
>=DateSerial(Year([Date]),Month([Date]),1)

That field is called Date

it brings up dates from over a month ago, dates duing the month and dates in the future?????

Thanks
 
Upvote 0
The problem is that you are using [date] which is your field rather than Date() which is a built in function. You are telling it to give you everything greater than the first day of the month in which the record was recorded.
try just copying my formula into your criteria cell and see what happens.

>=DateSerial(Year(Date()),Month(Date()),1)

Peter
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,873
Members
451,674
Latest member
TJPsmt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top