By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,207 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,207 IT Pros & Developers. It's quick & easy.

Need A97 code/query help.

P: n/a
pw
Hi,

I am having a mental block trying to figure out how to code this.

Two tables:

"tblQuestions" (fields = quesnum, questype, question)
"tblAnswers" (fields = clientnum, quesnum, questype, answer)

They are related by quesnum and questype. There are records in
tblAnswers for multiple clientnums.

What I need to do is to get every record from tblQuestions into the
tblAnswers table for every clientnum that is in the tblAnswer table.

Rats, I thought by typing out the problem I would have solved it but
nothing! :-)

Any ideas?
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
pw <***paulwilliamson@***spamcop.net> wrote in
news:tu********************************@4ax.com:
Hi,

I am having a mental block trying to figure out how to code
this.

Two tables:

"tblQuestions" (fields = quesnum, questype, question)
"tblAnswers" (fields = clientnum, quesnum, questype, answer)

They are related by quesnum and questype. There are records
in tblAnswers for multiple clientnums.

What I need to do is to get every record from tblQuestions
into the tblAnswers table for every clientnum that is in the
tblAnswer table. Rats, I thought by typing out the problem I would have solved
it but nothing! :-)

Any ideas?
Before I tell you how, I'm gonna tell you "Don't do it!'
You can just create the select queries and use it instead of
doing the additional steps.

First thing to do is create a select query with unique clientnum
as a parameter, and the tblquestions, then create a second query
with this query left joined to the tblAnswers on clientinum and
quesnum. You should not need any join on questype.

run the query, and note that you have all the questions and that
the unanswered questions have nothing in the answer field.

That's as far as you need to go.
Now to actually add the fields into the answers table, create a
new query with only the clientnum field, and the distinct values
property set to yes.

open the first select query, add the query with the clientnum
field, and change the original clientnum parameter to the
clientnum field. don't make any relation to the new field,

Now go to the second query, and add a condition to the answer
field, type IS NULL. without quotes.

If you run this query now, you will see a list of all the
unanswered clientnum-quesnum combinations.

Now create an append query based on this query that writes the
clientnum, quesnum, questype and "NO ANSWER" to the tblanswers.
Bob Quintal
..

-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure
Usenet News==---- http://www.newsfeed.com The #1 Newsgroup
Service in the World! >100,000 Newsgroups ---= 19
East/West-Coast Specialized Servers - Total Privacy via
Encryption =---


Nov 12 '05 #2

P: n/a
pw
>pw <***paulwilliamson@***spamcop.net> wrote in
news:tu********************************@4ax.com :
Hi,

I am having a mental block trying to figure out how to code
this.

Two tables:

"tblQuestions" (fields = quesnum, questype, question)
"tblAnswers" (fields = clientnum, quesnum, questype, answer)

They are related by quesnum and questype. There are records
in tblAnswers for multiple clientnums.

What I need to do is to get every record from tblQuestions
into the tblAnswers table for every clientnum that is in the
tblAnswer table.
Rats, I thought by typing out the problem I would have solved
it but nothing! :-)

Any ideas?


Hi Bob!
Before I tell you how, I'm gonna tell you "Don't do it!'
I was hoping someone would show me something different!!
You can just create the select queries and use it instead of
doing the additional steps.

Nice! My weakness! Always writing code I am! That is one great
feature about Access that I love: The query builder!
First thing to do is create a select query with unique clientnum
as a parameter, and the tblquestions, then create a second query
with this query left joined to the tblAnswers on clientinum and
quesnum. You should not need any join on questype.

run the query, and note that you have all the questions and that
the unanswered questions have nothing in the answer field.

That's as far as you need to go.


Sounds good!
Now to actually add the fields into the answers table, create a
new query with only the clientnum field, and the distinct values
property set to yes.

open the first select query, add the query with the clientnum
field, and change the original clientnum parameter to the
clientnum field. don't make any relation to the new field,

Now go to the second query, and add a condition to the answer
field, type IS NULL. without quotes.

If you run this query now, you will see a list of all the
unanswered clientnum-quesnum combinations.

Now create an append query based on this query that writes the
clientnum, quesnum, questype and "NO ANSWER" to the tblanswers.
Bob Quintal
.


This is good stuff Bob! I'll try it out 1st thing in the morning.
Thanks a lot!

-paul
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #3

P: n/a
pw
Hi Bob
Before I tell you how, I'm gonna tell you "Don't do it!'
You can just create the select queries and use it instead of
doing the additional steps.

First thing to do is create a select query with unique clientnum
as a parameter, and the tblquestions,


I don't know how to specify a unique field in the Access97 Query
designer.
then create a second query
with this query left joined to the tblAnswers on clientinum and
quesnum. You should not need any join on questype.
clientnum is only in the answers table so I can't join on it.


run the query, and note that you have all the questions and that
the unanswered questions have nothing in the answer field.

That's as far as you need to go.
Now to actually add the fields into the answers table, create a
new query with only the clientnum field, and the distinct values
property set to yes.

I don't have a distinct value property in the Access 97 query
designer.

Thanks,
open the first select query, add the query with the clientnum
field, and change the original clientnum parameter to the
clientnum field. don't make any relation to the new field,

Now go to the second query, and add a condition to the answer
field, type IS NULL. without quotes.

If you run this query now, you will see a list of all the
unanswered clientnum-quesnum combinations.

Now create an append query based on this query that writes the
clientnum, quesnum, questype and "NO ANSWER" to the tblanswers.
Bob Quintal
.

-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure
Usenet News==---- http://www.newsfeed.com The #1 Newsgroup
Service in the World! >100,000 Newsgroups ---= 19
East/West-Coast Specialized Servers - Total Privacy via
Encryption =---


-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.