Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2010
    Posts
    9

    Unanswered: MS Access - 2003: List Box

    Hi everyone, I am totally stumpped and REALLY hope someone can help me solve my List Box questions.

    I have an Access database and created an unbound form with an unbound List Box that retrieves employee names and EMP_ID from T_EMPLOYEE. I have created several queries and reports and I want to be able to select 1 employee from the unbound List Box (LIST_EMPLOYEE) and have the report (R_EMPLOYEE_HOURS) retrieve only the employee or employees I select.

    When I use the following code, the report is opened, but it returns all the employees, not just one.

    DoCmd.OpenReport "R_HOURS_EMPLOYEE", acpreview,"","", "[T_EMPLOYEE.EMP_ID], [T_EMPLOYEE.EMP_NAME] = ' " & me.LIST_EMPLOYEE.VALUE & " ' "

    Can someone PLEASE help me out with this??? Once, I get this to work with one selection from the list box, I need to be able to have this work with multiple selections from this list box.

    Once this list box works and I am able to run the report with either one employee or 4 employees, then I need to be able to have this code/list box work in conjunction with a second list box that contains the names of all reports I have developed run the report with the specific employee that was selected.

    It would be WONDERFUL if someone can help me with this.

    Thank you VERY MUCH in advance for your time and assistance.

    Kathy

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Is the Multi-Select Property for the Listbox set to something other than None? If so the Listbox has no Value Property and you have to use a different kind of code to retrieve the selected item(s) from it.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Here's a technique to use if the listbox is multiselect:

    Multi-Select Listbox
    Paul

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Thanks for adding that, Paul! I was away from my Access machine when I posted! It's documented so well I'm going to archive it for further posting!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You're welcome, and thanks!
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •