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

Need help with Month function

jenkinsloveschicken
Could someone please take a look at my query and tell me what I am missing? The strange thing is that when I first built the query, it was working fine. Then it broke. I suspect the problem is the Call Date field. Without the Call Date parameter the query runs fine. However I need the Call Date field so that I can specify the Month function to pull the cumulative data for month-to-date based on the current month(Unless someone else has a better method of doing this). I double checked my data types for the Call Date field and it is the same as when I first built the query. The goal is to calculate averages from the fields listed below and group by the line of business. At any rate, here is the query:

Avg([Centerwide CSAT].[Spnt Sat]) AS Spnt_Top_2 : Returns an average rating for company brand satisfaction

Avg([Centerwide CSAT].[Specialist Sat]) AS Specialist_Top_2 : Returns an average rating for specialist satisfaction

Avg(IIf([Centerwide CSAT].[Issue Rslv]<>'NA',[Centerwide CSAT].[Issue Rslv])) AS Issue_Resolved_Average : Returns an average value for Issue Resolved rankings excluding values of N/A

[Center Headcount].Account : Returns the line of business


SELECT Avg([Centerwide CSAT].[Spnt Sat]) AS Spnt_Top_2, Avg([Centerwide CSAT].[Specialist Sat]) AS Specialist_Top_2, Avg(IIf([Centerwide CSAT].[Issue Rslv]<>'NA',[Centerwide CSAT].[Issue Rslv])) AS Issue_Resolved_Average, [Center Headcount].Account
FROM [Centerwide CSAT] INNER JOIN [Center Headcount] ON [Centerwide CSAT].[Specialist Name] = [Center Headcount].Name
GROUP BY [Center Headcount].Account, [Centerwide CSAT].[Call Date]
HAVING ((([Centerwide CSAT].[Call Date])=(Month(Now()))));


Thanks,
Gerald
Jan 4 '07 #1
5 1868
Killer42
8,435 Expert 8TB
That's a very clear and detailed problem description, which is always a nice thing to see. However, could you please provide further detail on how it "broke"?
Jan 5 '07 #2
ADezii
8,834 Expert 8TB
Could someone please take a look at my query and tell me what I am missing? The strange thing is that when I first built the query, it was working fine. Then it broke. I suspect the problem is the Call Date field. Without the Call Date parameter the query runs fine. However I need the Call Date field so that I can specify the Month function to pull the cumulative data for month-to-date based on the current month(Unless someone else has a better method of doing this). I double checked my data types for the Call Date field and it is the same as when I first built the query. The goal is to calculate averages from the fields listed below and group by the line of business. At any rate, here is the query:

Avg([Centerwide CSAT].[Spnt Sat]) AS Spnt_Top_2 : Returns an average rating for company brand satisfaction

Avg([Centerwide CSAT].[Specialist Sat]) AS Specialist_Top_2 : Returns an average rating for specialist satisfaction

Avg(IIf([Centerwide CSAT].[Issue Rslv]<>'NA',[Centerwide CSAT].[Issue Rslv])) AS Issue_Resolved_Average : Returns an average value for Issue Resolved rankings excluding values of N/A

[Center Headcount].Account : Returns the line of business


SELECT Avg([Centerwide CSAT].[Spnt Sat]) AS Spnt_Top_2, Avg([Centerwide CSAT].[Specialist Sat]) AS Specialist_Top_2, Avg(IIf([Centerwide CSAT].[Issue Rslv]<>'NA',[Centerwide CSAT].[Issue Rslv])) AS Issue_Resolved_Average, [Center Headcount].Account
FROM [Centerwide CSAT] INNER JOIN [Center Headcount] ON [Centerwide CSAT].[Specialist Name] = [Center Headcount].Name
GROUP BY [Center Headcount].Account, [Centerwide CSAT].[Call Date]
HAVING ((([Centerwide CSAT].[Call Date])=(Month(Now()))));


Thanks,
Gerald
It seems to me as though in your HAVING clause, you are trying to equate a Date Field [Call Date], to an Integer value Month(Now()) returned from the Month() Function. Have you tried this in the HAVING clause instead?
Expand|Select|Wrap|Line Numbers
  1. HAVING (((Month([Centerwide CSAT].[Call Date]))=(Month(Now()))));
Jan 5 '07 #3
Killer42
8,435 Expert 8TB
It seems to me as though in your HAVING clause, you are trying to equate a Date Field ... to an Integer value Month(Now()) ...
Good catch! I missed that.

Still too many parentheses though, in my opinion. That's not a bug or anything, I just hate the way Access throws in great long unnecessary strings of the stupid things.
Jan 5 '07 #4
I am unsure of how it broke. I initially had problems with the Call Date parameter resulting in no records. So I played with the data type(original was Date/Time and I had changed it to Text) for the call date to see if it was a reference problem with the Month function. With the data type as Text, it results in inaccurate results, but Date/Time datatype is accurate in the report output. To be honest, I don't completely understand the all of the date functions in Access.

The query minus Call Date will run all of the appropriate averages for each line of business. However, the output is to a subform on one of the Main forms in the database and I would like it to always pull the averages based on month-to-date information in the underlying table. Is there an easier or more effective way to do this?

Also, I'm kinda lost with the original reply:
It seems to me as though in your HAVING clause, you are trying to equate a Date Field [Call Date], to an Integer value Month(Now()) returned from the Month() Function. Have you tried this in the HAVING clause instead?

What is meant by: Have you tried this in the HAVING clause instead? Do I need to manipulate the HAVING clause itself? Or change the datatype for the Call Date field to something else?

Thanks for the help, as it is much appreciated!

Regards,
Gerald
Jan 5 '07 #5
Sorry, I just went back and re-read the original reply and noticed the difference in the code. Thank you, I will try that and let you know if it works! Again, thanks for the help!
Jan 5 '07 #6

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

Similar topics

5
by: J. J. Cale | last post by:
Little astrology program has 2 text input boxes for birth dates. There are 3 selects for day month year that will supply output to whichever text input had the focus last. If the user picks from...
2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
0
by: Ewart MacLucas | last post by:
generated some WMI managed classes using the downloadable extensions for vs2003 from mircrosoft downloads; wrote some test code to enumerate the physicall processors and it works a treat, but a...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
7
by: Buck Rogers | last post by:
Hi all! Newbie here. Below is an example from Teach Yourself C in 21 Days. My apologies if it is a bit long. What I don't understand is how the "get_data" function can call the...
2
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
7
by: ajaydesai | last post by:
I have JavaScript code to dispaly two month calendar days at a time, but i have a problem both month that disaplay at a time have same days (for example May and June has same days, June and July have...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
29
by: Barry | last post by:
I know this is not a php question. If that bothers you, don't respond. If not, I sure could use the advice... I'm using a very abbreviated set of code to show a calendar. The idea is to simply...
3
by: aashishn86 | last post by:
var weekend = ; var weekendColor = "#e0e0e0"; var fontface = "Verdana"; var fontsize = 1; var gNow = new Date(); var ggWinCal; isNav = (navigator.appName.indexOf("Netscape") != -1) ? true :...
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: 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: 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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.