473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with Month function

jenkinsloveschicken
56 New Member
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 1883
Killer42
8,435 Recognized Expert Expert
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 Recognized Expert Expert
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 Recognized Expert Expert
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
jenkinsloveschicken
56 New Member
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
jenkinsloveschicken
56 New Member
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
1929
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 the list boxes the relative text input field is formatted d/m/y, the format that the cgi is expecting. The user can also input directly to the text...
2
2916
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 where there is no scripts allowed running (the software is from Opentext called Livelink)- therefore I need javascript to do the tasks listed below:...
0
3327
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 question.. The code fails with the error that: "Additional information: COM object that has been separated from its underlying RCW can not be used."...
14
3472
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. However, the expectation changes - it may be 60% for a while, then change to 50%. Initially, I was averaging the expectation, along with the...
7
2160
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 "continue_function", and if NO is returned to "get_data", display_report executes and the program ends? Basically I am having trouble understanding the program...
2
2070
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 using data imported from an Excel file and the person entering into Excel only cared about the month and day portion and Excel added the current year...
7
3813
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 same days etc.) Instate of correct days. Here is my code from 3 files....
2
3140
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 then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early...
29
1761
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 hide the calendar when it loses focus. I'm displaying the calendar in a span tag. When that span loses focus, I recurse through its children. If...
3
2141
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 : false; isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
0
7459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7803
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1871
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.