Re-Post Append to Append Query

D

dee

Hi there,

Awhile back, I posted about the following:

Have a main form and sub form.

When generate a new form, fill in the main form and tab to sub-form, an
append query is executed that populates the questions and possible answers
for the questionnaire selected in the main form. The user then selects there
response.

Now, however, additional questions have been added. This means I need to
execute some kind of additional append query that will ignore question ids
that have already been populated, and add new ones.

As he so often does, Allen Brown very kindly posted responses and I have
checked out the information on subqueries on his site, plus tried
(unsuccessfully) to achieve what he suggested. I'm a very basic SQL and VBA
level user, so am having syntax errors.

This is my code:
INSERT INTO tbl_response_details ( qstn_id, response_id )
SELECT tbl_questions.qstn_id, Forms!frm_general_qstnaire_info!response_id AS
response_id
FROM tbl_questions
WHERE
(((tbl_questions.qstnaire_id)=[Forms]![frm_general_qstnaire_info]![cbo_qstnaire_id])
AND NOT EXISTS
((SELECT * FROM tbl_response_details.qstn_id )= tbl_questions.qstn_id));

If anyone can provide guidance, it would be greatly appreciated.

Thanks so much!
 
K

Ken Snell \(MVP\)

Post the full VBA code that you're trying to run. What you've posted is just
an SQL statement.
 
D

dee

You're right. I originally posted when not sure of the approach in this
group. I should have reposted in the Queries discussion group.

I can't get the SQL to work and need to address that before anything else.

Sorry for posting incorrectly.

I appreciate your time.
--
Thanks!

Dee


Ken Snell (MVP) said:
Post the full VBA code that you're trying to run. What you've posted is just
an SQL statement.

--

Ken Snell
<MS ACCESS MVP>


dee said:
Hi there,

Awhile back, I posted about the following:

Have a main form and sub form.

When generate a new form, fill in the main form and tab to sub-form, an
append query is executed that populates the questions and possible answers
for the questionnaire selected in the main form. The user then selects
there
response.

Now, however, additional questions have been added. This means I need to
execute some kind of additional append query that will ignore question ids
that have already been populated, and add new ones.

As he so often does, Allen Brown very kindly posted responses and I have
checked out the information on subqueries on his site, plus tried
(unsuccessfully) to achieve what he suggested. I'm a very basic SQL and
VBA
level user, so am having syntax errors.

This is my code:
INSERT INTO tbl_response_details ( qstn_id, response_id )
SELECT tbl_questions.qstn_id, Forms!frm_general_qstnaire_info!response_id
AS
response_id
FROM tbl_questions
WHERE
(((tbl_questions.qstnaire_id)=[Forms]![frm_general_qstnaire_info]![cbo_qstnaire_id])
AND NOT EXISTS
((SELECT * FROM tbl_response_details.qstn_id )= tbl_questions.qstn_id));

If anyone can provide guidance, it would be greatly appreciated.

Thanks so much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top