Go to first record int able with user name from drop-down

Posted on 2011-10-18
Last Modified: 2012-05-12
I have a form that when teh user selects a name from the drop-down, I want the form to present the first record in the table that belongs to that user name.  There would be multiple records with the user's name, but I want the form to present the first record.  This is an ACCESS 2003 databse and needs to be written in VBA.  I can get to the last record and the first in the recordset, but i want to go to the first for a particular user.
Question by:ssmith94015
    LVL 9

    Accepted Solution

    let's say the user name is user1, and the table name is table1 and the order field is whateverorder then the following query will give you the desired data

    Select top1 * from
    (select * from table1 where username = user1 order by whateverorder) x


    Author Closing Comment

    Never would have thought of that, thank you.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
    The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now