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

Run update query from form to then populate subform

P: n/a
I have a database used for recording survey data. In the database, I
have a form that displays a survey participant and a subform that is
filled in by selecting a question from a looklist and then a
response. The questions are held in a table and they are always the
same. This is what I want to do.

I want a button on the main form that can be clicked,
When click, It will populate the survey detail table with the id of
the record currently displayed in the form and all the records from
the questions table.
Then refresh the subform to show those questions so the response field
for each can be entered.

Any help would be appreciated.

Feb 4 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
well, do it just as you say. write an Append query, based on the questions
table, and appending data into the "responses" table. for the foreign key
field in the responses table, use a reference to the primary key field in
the form as the "append *from*", as

Forms!MainFormName!PrimaryKeyFieldName

you can do this easily in query Design view.

add code to the form's command button to run the query and then requery the
subform, as

DoCmd.SetWarnings False
DoCmd.OpenQuery "NameOfAppendQuery"
DoCmd.SetWarnings True
Me!SubformControlName.Form.Requery

since the user will manually trigger addition of the subform records,
recommend you also add a check at the beginning of the code to look for
records in the subform. if they exist, the append code does not run. you can
use the Recordset or RecordsetClone property of the subform form object, or
use a DCount() function.

hth
"jeffro" <je********@yahoo.comwrote in message
news:11*********************@k78g2000cwa.googlegro ups.com...
I have a database used for recording survey data. In the database, I
have a form that displays a survey participant and a subform that is
filled in by selecting a question from a looklist and then a
response. The questions are held in a table and they are always the
same. This is what I want to do.

I want a button on the main form that can be clicked,
When click, It will populate the survey detail table with the id of
the record currently displayed in the form and all the records from
the questions table.
Then refresh the subform to show those questions so the response field
for each can be entered.

Any help would be appreciated.

Feb 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.