I am using Access 2003. I am setting up a form where a user selects a Clinic or Ward, beginning date, and ending date, and the form outputs the averages of a few fields based on that criteria. I have come up with this so far for the query -
Dim strSQL As String
strSQL = ""
If chkClinic.Value = -1 Then
strSQL = "Select avg(Courtesy), avg(Timeliness) , avg(Confidence) , avg(Privacy), " & _
"avg(Sensitivit y), avg(Cleanliness ), avg(Advice), avg(Overall) FROM tblScores " & _
"WHERE Clinic = '" & Me!cboClinic.Va lue & "' AND Date >= " & Me!txtBegin.Val ue & _
" AND Date <+ " & Me!txtEnd.Value
Else
strSQL = "Select avg(Courtesy), avg(Timeliness) , avg(Confidence) , avg(Privacy), " & _
"avg(Sensitivit y), avg(Cleanliness ), avg(Advice), avg(Overall) FROM tblScores " & _
"WHERE Ward = '" & Me!cboWard.Valu e & "' AND Date >= " & Me!txtBegin.Val ue & _
" AND Date <+ " & Me!txtEnd.Value
End If
But I'm having trouble getting the data pulled from that query into the proper text boxes (txtCourtesy, txtTimeliness, etc.). I've been pulling it into a recordset but I can't seem to get anything to work right. I think I just don't really have a grasp on how to manipulate a recordset yet.
Also - there is another category, "Handwashin g," in addition to these others. Whereas the other factors are on a 0-5 scale, so an average works fine, Handwashing is boolean. I would like to calculate Handwashing so that the query returns a percentage of numerator "true" and denominator of total records. I imagine I'll be able to do this part pretty easily once I figure out the other part.
1 1650 FishVal 2,653
Recognized Expert Specialist
Hi, there.
When you run SELECT query with calculated fields. The latter are being returned with default field names - like ExprXXXX. Do you refer them by this names?
If you want to explicitely set the name of calculated field, then use "AS" keyword.
e.g. -
SELECT Avg([FieldName]) AS AvgFieldName FROM [tblTable];
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Norma |
last post by:
I am posting this again since I am on a deadline to get this
completed... Sorry for being redundant...
I have a table with a UPC#, CasesCompleted, TotalHours, standardGoal
(pieces per hour)
I am generating a report that groups by UPC and figures out production
goals. In the Detail section of each UPC, I have a calculated field
that looks like this:
=sum()/sum()/()
This gives me the percentage of production. Each UPC has a different
|
by: Terencetrent |
last post by:
I having been using Access '97/2002 for about 4 years now and have
never really had the need or the time to learn visual basic. Well, I
think the time has finally come.
I need help with Visual Basic code that will examine numeric value for
a particular field in a query, and assign a new numeric vaule to that
field. There are over 21 possible values and I am told that IIF
statement will only handle 9 of the possibilities and that I need...
|
by: cowboyboborton |
last post by:
Looking for some help here. I've tried to solve this, but I just
can't. What I need to know is what formula to use in an excel
calculation to complete the following calculation. It's in two parts.
If first finds a natural logarithm, then converts it to a percentile.
Even if I had to do it in two steps on the spreadsheet, I can't
determine the calculations.
***************************************************
Logarithm System
The...
|
by: Fao |
last post by:
Hello, I am having some problems with inheritance. The compiler does
not not return any error messages, but when I execute the program, it
only allows me to enter the number, but nothing else happend. I think
the problem may be in my input function or in the main function.
If anyone out there can help me it woul be greatly appreciated.
Here is the code:
#include <iostream>
|
by: Kush |
last post by:
Hello All,
I am having problem writing some data to file and I do not understand
my mistake / misconception.
I am trying to write some simple text to file but the text is rather
output to screen!
Below is my entire code from my problem, but I just want to focus on
the method "write_percentage_per_side_to_file(ofstream &os)". From my
understanding I am passing an ofstream object which I declared in main(
| |
by: wparrott |
last post by:
I have a table called tblPayScales. It has 5 fields:
numRecID - record ID
txtCLASSCODE - a 1 or 2 letter text value (A, B, C, BD, L, LT, etc.)
numPAYSTEP - a number value 0-49
numSALARY - a number value such as 36,246.00
numNEWSALARY - a number value derived from a user-defined percentage
The table contains records for each CLASSCODE/PAYSTEP. Although there are 50 pay steps some have a value of 0 for numSALARY(no employee at that pay...
|
by: ABHICA2004 |
last post by:
Presently I'm dealing with a data base with the structure as under:
1.Source document is an excel file which contains thousands of rows ( item)& multiple columns ( relating to each individual item)which includes Text as well as numbers.
2.Source document is generated on a daily basis i.e.on each new day, a new file will be generated.
3.Requirement is to perform calculations based on each row( item) which will include...
|
by: patrickahutah |
last post by:
I need some help on computing this formula especially the best way to capture the data that is whether to use excel or ms access, then with the data compute the formula. The excercise is for bonus scheme calculation which is depended on various performance indicators.
Global Incentive (GI)
General Formula
GI = {(By-1) * (P/N)} + {X * (COMa-COMm) * (WRpa+UFWpa+CEpa+MRpa+TApa)
GI = Global Incentive that relate to the entire company
By-1...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |