Hi,
It's my first time to build a database and just learning Access as I
go . I am trying to design a simple database on survey tracking. Here
is my table structure:
tblPerson
PersonID (PK)
FirstName (text)
LastName (text)
Company(text)
Department(text )
Date (date/time)
tblPersonAnswer
PersonAnswerID (PK)
PersonID (text)
QuestionID (number)
AnswerChoiceAct ual (number)
AnswerChoiceImp ortance (number)
tblQuestions
QuestionID (PK)
QuestionNumber (text)
QuestionText (text)
I was asked to run a query to get a total sum of the AnswerChoiceAct ual
and the total sum of AnswerChoiceAct ual; then multiply those 2 fields
to come up a single answer per record; then add the total of
QuestionID1, QuestionID3 & QuestionID5. I was able to figure out the
following sql to run my first 2 queries:
qry1
SELECT Sum(tblPersonAn swer.AnswerChoi ceActual) AS ActualChoice,
Sum(tblPersonAn swer.AnswerChoi ceImportance) AS T_ImportanceCho ice,
tblPersonAnswer .QuestionID, tblPerson.Depar tment
FROM tblPerson INNER JOIN tblPersonAnswer ON tblPerson.Perso nID =
tblPersonAnswer .PersonID
GROUP BY tblPersonAnswer .QuestionID, tblPerson.Depar tment, (QuestionID)
HAVING (((tblPerson.De partment)="Exec "));
qry2
SELECT qry1.QuestionID ,
[qry1]![ActualChoice]*[qry1]![T_ImportanceCho ice] AS TotalScore
FROM qry1;
I've been struggling for a week now on how I can pull only a few
records in a table and get the total sum.
I'm sorry if I gave too much info but I just wanted to be as clear as
possible since I'm also still learning the terminology of this program.
Thank you so much in advance!!!
3 4665 MMcCarthy 14,534
Recognized Expert Moderator MVP Revise your queries as follows: qry1
SELECT Sum(tblPersonAn swer.AnswerChoi ceActual) AS ActualChoice,
Sum(tblPersonAn swer.AnswerChoi ceImportance) AS T_ImportanceCho ice,
Sum(tblPersonAn swer.AnswerChoi ceActual)*Sum(t blPersonAnswer. AnswerChoiceImp ortance) As TotalScore,
tblPersonAnswer .QuestionID
FROM (tblPerson INNER JOIN tblPersonAnswer ON tblPerson.Perso nID =tblPersonAnswe r.PersonID)
WHERE (((tblPerson.De partment)="Exec "));
GROUP BY tblPersonAnswer .QuestionID; qry2
SELECT Sum(IIf(Questio nID=1 Or QuestionID=3 Or QuestionID=5,To talScore,0)) As SumQ1Q3Q5
FROM qry1;
Thank you so much! Your query is much more simpler than mine.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Thank you so much! Your query is much more simpler than mine.
You're welcome!
Please repost if you have any further problems.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: btopenworld |
last post by:
Could someone point me in the right direction for writing, say, three
records into three table cells and then starting a new row for the next
three records.
(I've used While not EOF and MoveNext for writing each new record to a new
row - hope several records per row isn't too complicated)
Thanks
John
|
by: Oren |
last post by:
Hi,
I have an Access application with linked tables via ODBC to MSSQL
server 2000.
Having a weird problem, probably something i've done while not being
aware of (kinda newbie).
the last 20 records (and growing)of a specific table are locked - cant
change them - ("another user is editing these records ... ").
|
by: intl04 |
last post by:
I was told by an instructor of Oracle SQL that an MS Access database
cannot be used to have several people enter records at about the same
time, that the database will "freeze up" as a result - meaning, it'll
lock out everyone else until the first person who got to the database
(via a Web application, for example) is done updating his or her
record. He was saying that only one update can be done at a time to an
Access database.
However,...
|
by: mark |
last post by:
Access2000
How do I write a query that combines the CTC field from each record below into
one record? I need to concatenate the CTC field with a separator, like below:
BattID VehicleID STDATE STTIME CTC
LKO500HF 00000000 10/27/2003 4:13:51 AM 4
LKO500HF 00000000 10/27/2003 5:13:51 AM 5
LKO500HF 00000000 10/27/2003 10:13:51 AM 6
LKO500HF 00000000 10/27/2003 11:13:51 AM 4
|
by: Maital |
last post by:
Dear experts,
I'm a beginner with ms-access.
I have data from 3 years of observations on a certain field, divided
into North and South sections. The first table has information for
about 600 species. The other tables indicate weather a plant was found
on the field that year.
I'd like to create a query that combines the data for the 3 years, and
presents only the plants that grew in the field for at least one year.
| |
by: zek2005 |
last post by:
Hi!!!!
I have a list of records as a result of a query. They are displayed
with a while sentence...
while($row = mysql_fetch_array($res))
at the end of each record, I inserted a checkbox because I need to
update all the records that the user checks in the checkbox. So, the
process is:
|
by: Greg |
last post by:
Hi,
I have a table with "dates", i'd like to display those dates on a calendar.
I've put a calendar in a form, linked to my "date" field, and it works, but
only showing one "date" per calendar.
I can see all "dates" moving to next records, but one per calendar. :-(
Ex: 17/06 on one claendar, then if i click on next record, I can see my
calendar with 24/06 ...etc ...
|
by: ske |
last post by:
Hi
I've inherited an Access database where there is a form setup which prints out a Job Sheet. This works fine with one record. However I need to set it to loop through several records and print them all out programmatically.
This is my code which appears to work fine, but doesn't loop through the records, just prints off the first record however many times there are records to print. This is my code:
Private Sub cmdOK_Click()
On...
|
by: bluereign |
last post by:
Thank you for your assistance. I am a novice looking to JOIN and append or combine records from 2 current Tables into 2 new Tables named below. I have been able to JOIN Tables with the script below. My problem is if I don’t use the WHERE clause in my script below, the script can query up to 3 records with the same “LoanNo” due to the fact that there can be up to 3 “TypeCodes” in each Table (Borrower, Co-Borrower 1 and Co-Borrower 2...
|
by: farouqdin |
last post by:
Hi all i have code which loops through table and deletes the duplicate
records. This code does it for one table. How do i change it so it
goes through several tables?
On Error Resume Next
Dim db As DAO.Database, rst As DAO.Recordset
Dim strDupName As String, strSaveName As String
Set db = CurrentDb()
|
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: 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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |