random record selection asp and access

Posted on 2006-05-28
Last Modified: 2012-06-22
I want to select a random record with:

select top 1 * from llamadas order by newid()

With my MS SQL database it works fine but it gives an error with mdb files
Question by:robrodp
    LVL 33

    Accepted Solution

    use the rnd function in access....

    select top 1 *
    FROM [llamadas]
    ORDER BY RND(llamadas_ID);
    LVL 48

    Expert Comment

    by:Ryan Chong
    try like...


    RndKey = Int (1000*Rnd)+1

    SQLstr = "SELECT Top 1 Rnd(" & -1 * RndKey & " * id), " & _
                       "llamadas.* " & _
                       "FROM llamadas "
                       "Order By 1 "


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now