i have just used one of these i n one of my applications to get a random featured item here is a snipit of it (code wise)
this is actual code and works
strSQL = "SELECT " & strTablePrefix &
"Items.Stock, " & strTablePrefix & "Items.New_stock_date, "
& strTablePrefix & "Items.Item_ID, " & strTablePrefix &
"Items.Item_name, " & strTablePrefix &"Items.Item_price, "
& strTablePrefix & "Items.List_price, " & strTablePrefix
& "Items.Item_short_description, " & strTablePrefix &
"Items.Small_image FROM " & strTablePrefix & "Items WHERE "
& strTablePrefix & "Items.Active = True AND " &
strTablePrefix & "Items.Featured = True AND " &
strTablePrefix & "Items.Stock > " & intOutOfStock &
" AND " & strTablePrefix & "Items.Cat_ID = " &
intCatID & " ORDER BY " & strTablePrefix &"Items.Sort ASC,
" & strTablePrefix &"Items.Item_name; "
rsCommon2.cursortype = 1
rsCommon2.open strSQL, adoCon
if rsCommon2.eof then
else
rndMax = CInt(rsCommon2.RecordCount)
rsCommon2.MoveFirst
Randomize Timer
rndNumber = Int(RND * rndMax)
rsCommon2.Move rndNumber
|
this line
rsCommon2.cursortype = 1 allows you to move dynaticlly through the
recrdset and select a random record
then bring the details as ussual. the aboe works as i have just
installed the above in some code thaty im working on .. for a Access
version application.
Edited by dj air - 25 May 2005 at 9:14am