Posted on 2003-03-18
I have a table of questions with a DATE_LAST_USED field, I would like to extract 10 questions randomly and then change the value of the DATE_LAST_USED for these fields to the current date.
I currently have this:
INSERT INTO tbl_QUESTIONS ( QUESTION_ID, DATE_LAST_USED )
SELECT TOP 10 tbl_QUESTIONS.QUESTION_ID, Date() AS Expr1
ORDER BY Rnd([tbl_QUESTIONS].[QUESTION_ID]);
If I click on the 'View' button, then I get a list of ten random records and the current date, which is what I would expect to happen! :)
Except if I click on 'Run', then it says that it didnt add 10 records due to key violations, so I have tried removing the QUESTION_ID from the query which then dosent respond with any errors, just adds ten blank records (with the QUESTION_ID, which is an autonumber).
Thank you in advance for any help.