A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

YTD Formula doesn't work for Oct-Dec



 
 
Thread Tools Display Modes
  #1  
Old October 6th, 2004, 08:18 PM
Phil
external usenet poster
 
Posts: n/a
Default YTD Formula doesn't work for Oct-Dec

I have records which represent invoices including the date
and invoice total. In a query I add two columns
converting the date to a month number (1-12) and the date
to a year (2003, 2004, etc). The query prompts the sales
person for the [current year] and [current month]. The
YTD sales formula in the query is as follows:
if([current year]=[year] and [month]=[current month], ...
This function works until October (10), then I have to
change the formula to .... and [month]([current month]
+1),... this doesn't make any sense to me. The original
formala should work fine (it does for months 1-9), but as
soon as I hit a two digit month, it stops working.

The new formula works, but my curiosity is killing me.

Any ideas?

Phil
  #2  
Old October 7th, 2004, 05:12 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Phil, just wondering whether Access may be performing a text comparison
between these values instead of a numeric comparison.

If these are calculated fields, or numbers read from text boxes, see:
Calculated fields misinterpreted
at:
http://members.iinet.net.au/~allenbrowne/ser-45.html

The other possiblity is that the terms Year and Month are being
misunderstood at some point because these are the names of VBA functions.
You could try renaming your fields/controls.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil" wrote in message
...
I have records which represent invoices including the date
and invoice total. In a query I add two columns
converting the date to a month number (1-12) and the date
to a year (2003, 2004, etc). The query prompts the sales
person for the [current year] and [current month]. The
YTD sales formula in the query is as follows:
if([current year]=[year] and [month]=[current month], ...
This function works until October (10), then I have to
change the formula to .... and [month]([current month]
+1),... this doesn't make any sense to me. The original
formala should work fine (it does for months 1-9), but as
soon as I hit a two digit month, it stops working.

The new formula works, but my curiosity is killing me.

Any ideas?

Phil



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Maintain fixed section of formula in series T Wesley Worksheet Functions 2 June 21st, 2004 06:21 PM
formula will not work, has changed or disappeared Ray New Users 0 April 26th, 2004 02:08 AM
Excel formula does not work Tiffany Worksheet Functions 2 February 17th, 2004 03:46 PM
Formula Bar/Palette Problems ??? GBL Worksheet Functions 2 October 10th, 2003 02:40 PM


All times are GMT +1. The time now is 09:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.