رمز للسجلات العشوائية في مجموعة السجلات
<٪
'MovingTorandomRecord-Stevenjones'extension
ifnot (سجل مجموعة name.bofand سجل تعيين name.eof) ثم
'ResetTheCursortotheBeginning
if (recordset name.cursortype> 0) ثم
اسم مجموعة السجل. movefirst
آخر
اسم السجل. requery
Endif
nameseSSET_TOTALRN = -1
RecordSet name_totalrn = recordset name.recordCount'onyWorksOnsOmerEcordSets ، butmuchfaster
if (سجل set name_totalrn = -1) than'sandifitdid notwork ، WestillhavetOcountTereCords.
'countTheToTalRecordsByiteratingThroughTherecordset
nameseSSET_TOTALRN = 0
بينما (ليس سجل مجموعة name.eof)
RecordSet name_totalrn = Recordset name_totalrn+1
اسم السجل. movenext
ويند
'ResetTheCursortotheBeginning
if (recordset name.cursortype> 0) ثم
اسم مجموعة السجل. movefirst
آخر
اسم السجل. requery
Endif
Endif
'Nowdofinaladmustmes ، و movetotherandamrecord
RecordSet name_totalrn = recordset name_totalrn-1
إذا تم تعيين سجل name_totalrn> 0then
عشوائي
اسم مجموعة السجل.
Endif
Endif
'Alldone youchouldalwayscheckforanemptyrecordsetbeforedisplayingdata
٪>