Ok i found that the following query gives the right results:
Code:
SQLsurveyQuestions="SELECT tblQuestions.questionId, tblQuestions.questionName
FROM (tblQuestions LEFT JOIN tblSurveyQuestions ON tblQuestions.questionID = tblSurveyQuestions.questionID)
LEFT JOIN tblSurveys ON tblSurveyQuestions.surveyID = tblSurveys.surveyID
WHERE tblSurveys.surveyId=1"
Now my problem is that i need to get the answer names related to the anser Ids found with this query.
So i have the following tables:
tblSurveys:
-surveyId
-surveyName
tblQuestions:
-questionId
-questionName
-answerId1 (and 2, 3, 4, 5)
tblSurveyQuestions:
-surveyId
-questionId
tblAnswers:
-answerId
-answerName
I manage to get part of the answer with this query:
Code:
SQLsurveyQuestions="SELECT tblAnswers.answerId, tblAnswers.answerName
FROM ((tblAnswers LEFT JOIN tblQuestions ON tblAnswers.answerId = tblQuestions.answerId1)
LEFT JOIN tblSurveyQuestions ON tblQuestions.questionID = tblSurveyQuestions.questionID)
LEFT JOIN tblSurveys ON tblSurveyQuestions.surveyID = tblSurveys.surveyID
WHERE tblSurveys.surveyId=1"
But it can only give me the answer names for answerId1. How can I modify this to integrate answerId2, 3, etc? Should i use a loop on the query, or can i use the previously obtained recordset with a query only on the tblAnswers table?
Thanks for any help!
Philippe