Results 1 to 12 of 12
  1. #1
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53

    Question about Command Buttons and List Boxes on a Form

    Hello!



    I just recently started learning access, as I do alot of work with it on my new job. Currently I'm trying to create a specific database but having some issues. Mind you, I've only been using access for about a week so I'm pretty green still.

    Basically what I want to do is have a series of Command Buttons near the left part of my form, when clicked on display unique information in a list box along the right side of the form. From there, I want to click on the options in the list to fill in a series of fields along the bottom part of the form. I made a diagram to better explain what I'm talking about.

    Click image for larger version. 

Name:	FormBase.jpg 
Views:	5 
Size:	24.0 KB 
ID:	12086

    So basically I have Command Buttons on the left for each Department. I have a separate table made for each Department. So Department One has a specific table made for it that has Person 1, 2, 3, 4, 5 for example. And Department 2 has its own table that has Person 6, 7, 8, 9, 10, etc. What I want is to have it so when I click on the Department 1 Button, the List Box to the right shows a list of everybody from Department 1. Or when I click on Department 2, it shows everyone in Department 2, etc etc.

    Then, what I want is to click on a person within that list, to show additional information about that specific person in the fields at the bottom.

    How I have it setup table wise is that I have a Master Table that has everybody in it, all with the additional information such as Last Name, Email, ID, Title, etc etc. Then I have smaller tables for each individual Department connected to the Master Table with a relationship. So kinda like this...


    Department One Table

    [Auto-number Primary Key Field] [First Name]

    - Person 1
    - Person 2
    - Person 3
    - Person 4
    - Person 5


    Department Two Table

    [Auto-number Primary Key Field] [First Name]

    - Person 6
    - Person 7
    - Person 8
    - Person 9
    - Person 10



    Master Table

    [Auto-number Primary Key Field] [First Name] [Last Name] [Title] [ID] [Email]

    - Person 1
    - Person 2
    - Person 3
    - Person 4
    - Person 5
    - Person 6
    - Person 7
    - Person 8
    - Person 9
    - Person 10


    Make sense? Anyway, any help would be much appreciated. I'm basically looking for some advice on how to best do this.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Not sure that your table structure is quite right.
    See the attached db.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    That's definitely how I want it to work. Thanks for uploading that. However, one question that I am confused on. Where are the actual tables? Where is it pulling that information from? All I see is a Form in the attached DB.

  4. #4
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Nm, the tables were hidden along the left hand pane. I see them now.

    This definitely puts me on the right path, thank you very much. I will post back if I have any further questions

  5. #5
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Actually I gots a question already. How do I make so that Last Name field is invisible in the List box portion. I just want a single field to show up in the List Box, but multiple fields to show up in the bottom part. So I either need a way for a single field to load all the info into the fields below, or a way to make the extra fields in the list box be invisible.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    The form is unbound.
    Look at the Row Source property of each list control, to see how they are populated.
    The text boxes that display the names are populated by referencing the columns of the list box called lstPeople.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Quote Originally Posted by Nuke1096 View Post
    Actually I gots a question already. How do I make so that Last Name field is invisible in the List box portion. I just want a single field to show up in the List Box, but multiple fields to show up in the bottom part. So I either need a way for a single field to load all the info into the fields below, or a way to make the extra fields in the list box be invisible.
    A list box has a Column Widths property. If you set a column to 0cm, then it will not be visible. The lstPeople list box already has the first two columns hidden.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Quick question.

    Alternatively, how would I use a Command Button instead of a List box to reference the 1stPeople List Box instead of using the 1stDept List Box to do so. I realize I would need to create 1 Button for each Department, but thats ok. I would prefer that.

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    You could use a button for each department instead of a list box, but that the advantage of a list box is that if new departments are created the form would then need more buttons added to it. With a list box the new departments would just appear in the list. So, are you sure you still want buttons?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Ya I think I still want to go with buttons. Even if just for the learning experience.

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    OK, as compromise, how about this:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  12. #12
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Yup that worked fine. I have everything working at the moment. I just need to build the database and then make it look pretty.

    Thx for all the help. If I have any more questions I'll check back to this thread

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Command Buttons Stopped Working on Form
    By genest11 in forum Reports
    Replies: 12
    Last Post: 02-06-2013, 06:59 AM
  2. Form Command buttons
    By chazcoral2 in forum Forms
    Replies: 6
    Last Post: 05-01-2012, 08:10 AM
  3. Command Buttons on form
    By bespra in forum Forms
    Replies: 10
    Last Post: 11-12-2011, 01:50 PM
  4. Search form with list boxes
    By scottay in forum Programming
    Replies: 15
    Last Post: 07-27-2010, 09:28 AM
  5. Replies: 2
    Last Post: 04-11-2006, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums