N Top Record Selection Based on Own SQL Statement in MS-Access -
I rewriting a small MS-Access application to take the exams.
Based on the size of the test size, what they want to achieve a set of random questions.
If each test had a certain number of questions, then I should just leave the number given in the head
and be done with it, but for each exam, a number of There are questions, so I want to change the number continuously next to the head
with a field in the query
What I basically want is that:
SELECT TOP tblExam. [ExamSize] * TblExamQuestions at INNER TblExam on tblExamQuestions.ExamID = TblExam.ExamID WHERE tblExam.ExamID = Rnd (tblExamQuestions.ExamQuestionID) from 10th order;
When I open the report, I am supplying this new ExamID
for each exam session, so it will probably be on the way.
DoCmd.OpenForm strExamName, "tblExam.ExamID =" & amp; I think you have to create dynamic queries. ex> sSQL = "select top" & amp; DlookUp ("ExamSize", "TblExam", "ExamID = 10") _ & amp; "Join TNL Join with INF from TblExamQuestions" _blank "At tblExamQuestions.ExamID = tblExam.ExamID" _ & amp; "WHERE tblExam.ExamID = 10" _ & amp; "ORDER BY RND (tblExamQuestions.ExamQuestionID)" '' CurrentDB.QueryDefs ("MyReportQuery") replaces an existing query permanently. SQL = SSQL
Comments
Post a Comment