Question on listbox and opening form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Hidalgo

    Question on listbox and opening form

    Hi,

    I have an issue that I am trying to resolve. I am populating a list
    box with employee names and would like to have the capability for a
    user to open an employee record by double clicking on the emplpoyee
    name in the listbox. Is this possible to do?

    Thanks,

    Daniel Hidalgo
  • Yamafopa!

    #2
    Re: Question on listbox and opening form

    Depending on structure, you can cerainly do this. You would have an employee
    form bound to an employee table. The list box would have a column for the
    record id of the employee records and the employee names. If you set the
    bound column of the list box to the record id of the employee records and
    then you can reference the value of that control in your openform statement.

    In the doubleclick event of the list box, run the docmd.openform and pass
    the record id as a criteria...

    DoCmd.OpenForm "frmEmploye e", , , "emp_no = " & Me.lstEmployees

    hth
    Chris


    "Daniel Hidalgo" <hdawg25@hotmai l.com> wrote in message
    news:ea96d14f.0 403041118.e4a89 19@posting.goog le.com...[color=blue]
    > Hi,
    >
    > I have an issue that I am trying to resolve. I am populating a list
    > box with employee names and would like to have the capability for a
    > user to open an employee record by double clicking on the emplpoyee
    > name in the listbox. Is this possible to do?
    >
    > Thanks,
    >
    > Daniel Hidalgo[/color]


    Comment

    • Pieter Linden

      #3
      Re: Question on listbox and opening form

      hdawg25@hotmail .com (Daniel Hidalgo) wrote in message news:<ea96d14f. 0403041118.e4a8 919@posting.goo gle.com>...[color=blue]
      > Hi,
      >
      > I have an issue that I am trying to resolve. I am populating a list
      > box with employee names and would like to have the capability for a
      > user to open an employee record by double clicking on the emplpoyee
      > name in the listbox. Is this possible to do?
      >
      > Thanks,
      >
      > Daniel Hidalgo[/color]

      Except you can't use the Multi-Select option of the listbox if you
      want to do this. If you did, you would have to loop through the
      ItemsSelected collection of the listbox and create a valid WHERE
      statement that you could pass to the form you would be opening. You
      can get code for it at www.mvps.org

      Comment

      Working...