473,379 Members | 1,185 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,379 software developers and data experts.

Selecting Records from a previous Month

Hi Group

I am designing a report that should show a meter reading for each
month and the previous meter reading for the previous month. The
months are text stored in a field tMonth.

The current month is easy to pull out of the data base but I don't
know how to get the previous months meter reading.

The previous reading is subtracted from the current reading to get the
months usage
Please Help

Thanks
Nov 12 '05 #1
1 5107
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When you say the months are stored as text do you mean the month
number (1-12) or the month name? If the month name what's its format
first 3-letters of month name or complete month name?

You can find out the previous month by using the DateAdd() function.
E.g.:

Last month's number:

month number = Month(DateAdd("m", -1, Date()))

Last month's name:

3-ltr month:
month name = Format(DateAdd("m", -1, Date()), "mmm")

full month name:
month name = Format(DateAdd("m", -1, Date()), "mmmm")

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP84s44echKqOuFEgEQLPDACg5OWfsIWmGjTN8He2Q75/286R4+IAoNqa
sWn75XOUBu1My49L95ObolTX
=Yz0T
-----END PGP SIGNATURE-----

Finlay wrote:
Hi Group

I am designing a report that should show a meter reading for each
month and the previous meter reading for the previous month. The
months are text stored in a field tMonth.

The current month is easy to pull out of the data base but I don't
know how to get the previous months meter reading.

The previous reading is subtracted from the current reading to get the
months usage
Please Help

Thanks

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: eddie wang | last post by:
How to convert a month to previous month in a very easy way? For example, I have AUGUST, but I want JULY to return. Thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't...
5
by: Ray via SQLMonster.com | last post by:
Hi there, See if you can help me with the following: I need to write an SQL code that will return me: The 1st day & the Last day of the Previous Month in the following format...
1
by: vijay4oracle | last post by:
can i have a query for finding the lastday of the previous month
2
by: TB | last post by:
HI, is there a formula(function) you could use to the display the previous month's name in a report. i know there is a function(formula) that returns the previous month's value (ie 4 for the...
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...
10
by: Massimo30 | last post by:
Looking for answers and have done a search in books and websites and still can't find the answer: I am setting up a Market Trend DB on housing figures. I have the following fields in my table: My...
10
by: samhale | last post by:
Hopefully an easy one. Can someone please supply me with the code for displaying the previous month? I do not want just -3 from December for October. It needs to work each month without modifying....
0
by: marlberg | last post by:
Platform: Windows2000, WindowsXP, Windows Vista, etc Language: C#, ASP.NET Pre-compiled Libraries: Enterprise Library 3.0 full I have a requirement to implement in and display in C# and...
1
by: Shawn29316 | last post by:
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.