|
-
April 1st, 2001, 03:09 AM
#1
visual basic
I am doing a project on online examination. I have entered data (questions) into the database. I would be thankful if anybody can suggest the code for automatically radom selection of questions when a student appears for the test.
Thanks.
-
April 1st, 2001, 07:59 AM
#2
Re: visual basic
I fyou have an autoincrement field in your database, then it is easy.
Determine a random number using
QNo = Int (Rnd*NoOfQuestions)+1
Then use FindFirst to determine the record with this number in the ID field
But it might result in the same question number being repeated again. To prevent this
dim UsedNum as string
for i=1 to 10 'to select ten questions
do
QNo = Int (Rnd*NoOfQuestions)+1
Loop until Instr(UseNum, QNo & ", ")=0
UsedNum = UsedNum & QNo & ", "
'Do other work here
next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|