A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Survey Qustion



 
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2009, 09:08 PM posted to microsoft.public.access.queries
dsmith via AccessMonster.com
external usenet poster
 
Posts: 11
Default Survey Qustion

I'm working on a survey database but I 've run into a problem. The series of
questions I'm asking will all have 1 of 3 possible answers; yes, no, or NA.
I'm using a drop down box that provides the choices to the user. Is there a
way to do this and be able to count the number of times each answer is
selected? I've tried using the yes/no featue but couldn't solve the "NA"
option

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200911/1

  #2  
Old November 23rd, 2009, 10:23 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Survey Qustion

On Mon, 23 Nov 2009 21:08:45 GMT, "dsmith via AccessMonster.com" u56186@uwe
wrote:

I'm working on a survey database but I 've run into a problem. The series of
questions I'm asking will all have 1 of 3 possible answers; yes, no, or NA.
I'm using a drop down box that provides the choices to the user. Is there a
way to do this and be able to count the number of times each answer is
selected? I've tried using the yes/no featue but couldn't solve the "NA"
option


You won't be able to use a Yes/No field in the table. Try using an Integer
field instead, using (say) 0 for No, 1 for Yes, 2 for NA; you can use an
Option Group control or a Combo Box on the form to select the appropriate
choice.
--

John W. Vinson [MVP]
  #3  
Old November 24th, 2009, 12:23 AM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Survey Qustion

dsmith via AccessMonster.com wrote:

I'm working on a survey database but I 've run into a problem. The series of
questions I'm asking will all have 1 of 3 possible answers; yes, no, or NA.
I'm using a drop down box that provides the choices to the user. Is there a
way to do this and be able to count the number of times each answer is
selected? I've tried using the yes/no featue but couldn't solve the "NA"
option



If I understand what you are trying to do??

This is a standard way to do that kind of thing:

SELECT QuestionNumber, Answer, Count(*)
FROM table
GROUP BY QuestionNumber, Answer

But, I suspect that this is more like what you want:

SELECT QuestionNumber,
Sum(IIf(Answer = "Yes", 1, 0)) As NumYes,
Sum(IIf(Answer = "No", 1, 0)) As NumNo,
Sum(IIf(Answer = "NA", 1, 0)) As NumNA,
FROM table
GROUP BY QuestionNumber

--
Marsh
MVP [MS Access]
  #4  
Old November 25th, 2009, 03:53 PM posted to microsoft.public.access.queries
dsmith via AccessMonster.com
external usenet poster
 
Posts: 11
Default Survey Qustion

thanks I think I understand...

John W. Vinson wrote:
I'm working on a survey database but I 've run into a problem. The series of
questions I'm asking will all have 1 of 3 possible answers; yes, no, or NA.
I'm using a drop down box that provides the choices to the user. Is there a
way to do this and be able to count the number of times each answer is
selected? I've tried using the yes/no featue but couldn't solve the "NA"
option


You won't be able to use a Yes/No field in the table. Try using an Integer
field instead, using (say) 0 for No, 1 for Yes, 2 for NA; you can use an
Option Group control or a Combo Box on the form to select the appropriate
choice.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200911/1

  #5  
Old November 25th, 2009, 03:54 PM posted to microsoft.public.access.queries
dsmith via AccessMonster.com
external usenet poster
 
Posts: 11
Default Survey Qustion

Thanks. I used a combination of the info from you and John...teamwork.

Marshall Barton wrote:
I'm working on a survey database but I 've run into a problem. The series of
questions I'm asking will all have 1 of 3 possible answers; yes, no, or NA.
I'm using a drop down box that provides the choices to the user. Is there a
way to do this and be able to count the number of times each answer is
selected? I've tried using the yes/no featue but couldn't solve the "NA"
option


If I understand what you are trying to do??

This is a standard way to do that kind of thing:

SELECT QuestionNumber, Answer, Count(*)
FROM table
GROUP BY QuestionNumber, Answer

But, I suspect that this is more like what you want:

SELECT QuestionNumber,
Sum(IIf(Answer = "Yes", 1, 0)) As NumYes,
Sum(IIf(Answer = "No", 1, 0)) As NumNo,
Sum(IIf(Answer = "NA", 1, 0)) As NumNA,
FROM table
GROUP BY QuestionNumber


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200911/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.