Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Month-Over-Month    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Month Over Month
Kostas Vergos 
    
5 years ago
Hi,
I am very new to the access programming. I tried the month over month procedure exactly as the video describes and i get wrong results as the following table:
Y          M     Expenses        Y2        M2     BeginDate      EndDate        Previous month Expenses
2020     11     500             2020     10    1/10/2020      31/10/2020               0,00
2020     12     600             2020     11    1/11/2020      30/11/2020               500,00
2021      1     33.169,10     2020     12    1/12/2020      31/12/2020               1.100,00
2021      2     100              2021     1      1/1/2021        31/1/2021                33.169,10
2021      3     100              2021     2      1/2/2021        28/2/2021                32.964,50
2021      4      50               2021     3      1/3/2021        31/3/2021                33.057,20

Pls i need your help on this
Thank you


Kevin Robertson  @Reply  
          
5 years ago
Can you post the exact function you are using for PreviousMonthExpenses
Kostas Vergos OP  @Reply  
    
5 years ago
Sorry for the delay, the function is:

Previous month expens: Format(Nz(DSum("[Expenses]";"[MyTable]";"[ExpenseDate]>= #" & [BeginDate] & "# AND [ExpenseDate]<=#" & [EndDate] & "#");0);"Currency")
Kostas Vergos OP  @Reply  
    
5 years ago
Hi Kevin,
Just a reminder that i have posted the function for PreviousMonthExpenses
Scott Axton  @Reply  
        
5 years ago
You have a semi-colon ' ; ' for the NZ  which should be a comma ' , '.
      Yours:   [EndDate] & "#");0);"Currency")
Should be:   [EndDate] & "#"),0);"Currency")
Access wont even allow the the semi-colon.  

Did you copy and paste the formula here or re-type it?  

Kostas Vergos OP  @Reply  
    
5 years ago
Scott thank you for your reply. My computer's operating system accepts semi colon for access but i chenged the settings to accept comma instead of semi colon. Still i get the same wrong results.
Also in your reply you wrote "Should be":   [EndDate] & "#"),0);"Currency"). If i put a semi colon before ;"Currency" is not accepted by Access.
So, i copy-paste the formula as it is now but as i said i get the same wrong results:
Previous month expens: Format(Nz(DSum("[Expenses]","[MyTable]","[ExpenseDate]>= #" & [BeginDate] & "# AND [ExpenseDate]<=#" & [EndDate] & "#"),0),"Currency")
Kostas Vergos OP  @Reply  
    
5 years ago
Scott, a note about the dates, in my country and in my operating system the format is as follows: dd/mm/yyyy instaed of mm/dd/yyyy as is in your region.
Richard Rost  @Reply  
          
5 years ago
I recreated the query EXACTLY using your data. My results come out just fine. So you either typed something wrong in while building the query, OR it's a regional problem. I've only tested this with US date formats.
Richard Rost  @Reply  
          
5 years ago

Richard Rost  @Reply  
          
5 years ago
All of the functions that I used, DateAdd, DateSerial, Month, Year, etc. should be completely regional agnostic.
Richard Rost  @Reply  
          
5 years ago
Let me see your raw data from the table.
Kostas Vergos OP  @Reply  
    
5 years ago
Thank you very much, i will keep working on that.
Kostas Vergos OP  @Reply  
    
5 years ago
IDExpenseDateExpenses
112/2/2021119,98
212/2/202143,00
312/2/202131,55
410/2/2021170,00
510/2/202133,68
613/2/20214,60
713/2/20213,70
813/2/20211,00
913/2/20211,50
1026/2/2021200,00
1110/2/202120,82
1215/2/202194,99
1315/2/2021306,41
1415/2/2021318,68
1515/2/2021294,99
1624/2/202163,86
1716/2/202180,60
1816/2/202123,80
1916/2/202144,03
2016/2/20215,60
2116/2/202120,13
2217/2/202143,00
2317/2/20216,39
2416/2/202162,00
253/2/2021155,00
2618/2/202130,00
2718/2/202162,00
2818/2/20211,20
2918/2/202113,05
3018/2/202184,52
3124/2/202163,09
3224/2/202170,31
3319/2/202155,00
3419/2/20213,85
3520/2/202120,00
3620/2/20211,50
3724/2/202191,07
3824/2/2021288,92
3924/2/2021324,01
4022/3/2021174,86
4122/2/202134,26
4222/2/20214,30
4322/2/20211,40
4422/2/20212,00
4522/2/20211,50
4626/2/2021620,00
471/3/2021178,94
Richard Rost  @Reply  
          
5 years ago
I don't see anything that jumps out with your data. It's got to be your regional settings. See this other thread from Kevin. He had the same problem, switched to US format, and it worked fine. You've got me. I'm not an expert with anything other than US dates.
Kostas Vergos OP  @Reply  
    
5 years ago
Hahaha, thank you very much, i ll keep trying and i ll let you know
Kevin Robertson  @Reply  
          
5 years ago
Kostas,

Formatting even one of the dates to U.S format seems to work.

Previous month expens: Format(Nz(DSum("[Expenses]";"[MyTable]";"[ExpenseDate]>= #" & Format([BeginDate], "mm/dd/yyyy") & "# AND [ExpenseDate]<=#" & [EndDate] & "#");0);"Currency")
Kostas Vergos OP  @Reply  
    
5 years ago
Richard,
i used the formula Kevin wrote for me, formatting the date to U.S format: Format([BeginDate], "mm/dd/yyyy", solved the problem
Thank you very much
Kostas
Richard Rost  @Reply  
          
5 years ago
Thank Kevin. Make sure to give him a LIKE (Heart). :)
Kostas Vergos OP  @Reply  
    
5 years ago
Kevin, You are great!!!!, thank you very much for your help. Everything works fine.
Kostas

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Month-Over-Month.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 3:11:37 PM. PLT: 1s