473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Looking for previous month's beginning and ending dates

Hi,
I'm trying to query a table to find records created between the first and last day of the previous month. I'm having no luck with the help feature in Access. Can someone point me in the right direction?

Thanks,
Jul 10 '08 #1
1 3822
missinglinq
3,532 Expert 2GB
First of the previous month
Expand|Select|Wrap|Line Numbers
  1. DateSerial(Year(Date), Month(Date) - 1, 1)  
Last of the previous month
Expand|Select|Wrap|Line Numbers
  1. DateSerial(Year(Date), Month(Date), 0)
You can use these formulas with the Between operator in the criteria field for your date in the underlying query. Using it like this, you need to let Access know that Date is a function, not a field, so you have to add the parentheses after it, like Date(). The criteria would look like this:

Expand|Select|Wrap|Line Numbers
  1. Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)
  2.  
Linq ;0)>
Jul 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Matt | last post by:
My ASP page allows the user select the date, and it will display the report during that week of that date. My question is when the program query database, I need to know the beginning date and...
5
by: Derek Cooper | last post by:
I hope you can help me. I posted this in the microsoft sql server newsgroup a few days ago and got no response so I thought I'd try here. If I can provide any clarification I'll be glad to do so....
1
by: manning_news | last post by:
Using SQL 2000. I need to select rows based on a date range. Both the beginning date and ending date of the range will be entered in the mm/dd/yy format. There are 2 columns in the table called...
19
by: Stimp | last post by:
preferably one that when clicked can update three date dropdowns (day, month, year) like http://www.visitdublin.com/carhire/avis.asp Don't mind paying for the file... anyone seen something...
2
by: Rupert Street | last post by:
I would like to set up a command button on a timesheet form to preview the jobs a contractor has worked on for the month. I would like if possible when the button is clicked for it to ask for the...
12
by: Orchid | last post by:
Hello all, I have different version of reports which used for different months. For example, I am using report version 1 up to September, but we have some design changes on the report for October,...
22
by: Stan | last post by:
I am working with Access 2003 on a computer running XP. I am new at using Access. I have a Db with a date field stored as mm/dd/yyyy. I need a Query that will prompt for the month, ie. 6 for...
9
by: brymcguire | last post by:
Hi, I have a requirement to design a query that identifies items sold between two dates. There is a 'SoldDate' datetime field used to register what date the item was sold. The query needs...
1
by: shiznaw | last post by:
Private Function rprtdate() Dim rprtdates As Date Dim 1mnth As Integer 1mnth= Month(Date) + Month(DateSerial(Year(Date), Month(Date) + 1, Day(Date))) Select Case Frame35.Value 'the following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.