Tim, you're still fighting with this! Some older versions of Access needed a "random" seed for the randomizer function (RND) otherwise they would return the same sequence of "random" numbers each time the application was run. Maybe that's your problem?
Try the code below. This should work on any version of Access. It selects the current second and uses that as the randomizer seed, so you should see more-random results. SELECT TOP 1 Pictures.* FROM Pictures WHERE (((Pictures.PIC_ID)<=(SELECT MIN(Pictures_1.PIC_ID) + CLng(ROUND(RND(CInt(Right$(Time$(),2))) * (MAX(Pictures_1.PIC_ID) - MIN(Pictures_1.PIC_ID)), 0)) FROM Pictures AS Pictures_1))) ORDER BY Pictures.PIC_ID DESC; This is tested in MS Access 2002 and it works! I hope this will finally be the end of this thread, but I'll bet you hope that even more than I! :-) HTH -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 5:19 PM To: ActiveServerPages Cc: [EMAIL PROTECTED] Subject: RE: Random picture from a Database Unfortunately, I'm not getting a random image each time, I get the same one every time, Record 30.. sSQL="SELECT TOP 1 a.* FROM Pictures a WHERE a.PIC_ID <= (SELECT MIN(b.PIC_ID) + CLng(ROUND(RND() * (MAX(b.PIC_ID) - MIN(b.PIC_ID)), 0))" sSQL= sSQL & " FROM Pictures b) ORDER BY a.PIC_ID DESC" Help? --- You are currently subscribed to activeserverpages as: [EMAIL PROTECTED] To unsubscribe send a blank email to %%email.unsub%% --- You are currently subscribed to activeserverpages as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
