Results 1 to 5 of 5
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Dec 2010
    Posts
    209

    Double Click Sub-Form To Show New Sub-Form

    Hi - I have a form, and on that form it has a subform that query results for a query that is


    Code:
    Select stopLightColor, Count(student) From tblStudentDay;
    Which shows sample data like this
    Color --- Count
    Green 12
    Yellow 4
    Red 9


    What I would like to do from here is when a user clicks on a row, a separate sub-form shows and it shows the names of the students who were that color. For example, if the user clicks Yellow, then I want the sub-form to .Visible = True
    and list of the 4 names like

    Studen Name
    James Jones
    Bob Jackson
    Mitch Manfred
    Sam Smith

    How would I set-up the on-click event to do this?

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Readers need more info about your table(s) and your forms. It would be helpful to you and to readers if you could provide a brief description of your application that ties the table, queries and forms together. Perhaps you could provide an example describing the overall processing intent.
    Good luck with your project.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Not really sure what you want. It would really help if you posted an example dB... but here is one way
    Attached Files Attached Files

  4. #4
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Dec 2010
    Posts
    209
    Quote Originally Posted by ssanfu View Post
    Not really sure what you want. It would really help if you posted an example dB... but here is one way
    Yes, this is exactly what I am after. Where is the code stored to change the sub form from the click of the stoplight color?

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    As I said, this is just one method.... Since you didn't post your dB (or an example of your dB), I made a table - hope it was close to what you have.

    So here we go.
    The main form's record source is an aggregate query to get the count of each of the colors.
    The sub form's record source is a query with a where clause. The where clause is looking at the stoplightcolor field in the main form, which filters the records (in the sub form) to only the color selected in the main form.
    Clicking on different color (record) in the main form, causes the sub form to be re-queried.
    There is no code involved!

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

Similar Threads

  1. Replies: 12
    Last Post: 03-22-2019, 09:42 AM
  2. Double click on listbox to open up form
    By EthanMoist in forum Forms
    Replies: 14
    Last Post: 05-21-2013, 02:10 PM
  3. On Double Click Open Form with two criteria
    By AndreasPanayiotou in forum Programming
    Replies: 3
    Last Post: 09-10-2012, 08:47 AM
  4. Replies: 10
    Last Post: 02-20-2012, 11:25 AM
  5. Opening another form by double click
    By chrisjack001 in forum Access
    Replies: 1
    Last Post: 10-13-2010, 02:19 PM

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