ki ki was very helpful in getting me in the right direction as I am trying to create a survey form that consists of a main form where the user enters name, whether the survey is "internal" or "external" and a few other pieces of information. Based on the selection of internal or external, an append query will run appending tblSurveyDetail, which takes the QuestionID which belong to either internal or external and include a SurveyID which is created by the user entering the mainform data (i.e. name, survey type, etc.). The subform then refreshes and is reading tblSurveyDetail, and in that subform the user enters survey results.
My questions: 1. How do I save the main form record and then run the append query? In other words, what is the event that I can use to trigger running the action query.
2. once the action query is run, what is the event that will trigger running the refresh of the subform?
3. Sidbar question: The subform is in datasheet mode. Questions may be either a number (0-4) or text (survey comments). I have a checkbox indicating which Questions are text or value-based. How can I grey-out the value field for those questions which have textvalue = true?
Thanks!!!!! Listed below is kiki's response:
ki_ki:I see what you want to do.
Here is what I'd do:After the user enters her name, save that record in the tblSurvey. No need for the user to add the date. Make the default value for date as Now(). After that get surveyID (I am guessing it's an auto number). Use that(surveyID) and create an insert query (in code) : the insert query will insert as many records as you want in table tblSurveyDetail. Each record would have the PK as surveyID and the QuestionsResponse. At the end requery the subform...this will dispaly the questions in the subform (subform, starts as blank ...before the user added her name). On the subform lock the QuestionsResponse field (QuestionsResponse.locked=true). And also don't allow additions and don't allow deletion on the subform. Hope I was clear enough.