Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    When I placed the button in the Form design view it asked me what the form does and I went to miscellaneous then run query and selected the query I have set up.

  2. #17
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So when you click on the button, the query is displayed separate from the form?

    Open the query "LunchQuery" in design view, switch to SQL view, Copy the SQL and paste it in here so I can see it. Please.

  3. #18
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    Here it is:

    SELECT AllStudents.FNAME, AllStudents.LNAME, AllLunch.[HotCold], AllLunch.type, AllLunch. Sum(AllLunch.AMOUNT) AS SumOfAMOUNT, AllLunch.YEARofLunch
    FROM AllLunch RIGHT JOIN AllStudents ON AllLunch.ID = AllStudents.[ID]
    GROUP BY AllStudents.FNAME, AllStudents.LNAME, AllLunch.[HotCold], AllLunch.type, AllLunch.YEARofLunch
    HAVING (((AllLunch.YEARofLunch)=IIf([Forms]![LunchList]![2012Check],2012,-1)));

  4. #19
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    What is the field "AllLunch.YEARofCon"?

  5. #20
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    It was a miss type. It should be YearofLunch and I updated it in the post.

  6. #21
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Rather than try and type everything, look at this example. I tried to get it as close as possible to what you gave me. (Access 2000)

    Again, this is not the best way, but it is the way you wanted.
    I enter only a few names. Look at the years before you check the check boxes. Then click "Search". "Show All" removes the filter.
    I don't know all of your field names, but I did the best I could....


    ---------------
    Note: "ID" is not a good name - it is not descriptive
    "Type" is a reserved word in Access and shouldn't e used as object names.

  7. #22
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    Whoa thanks. Where is the query and form design so I can try to learn how you did that and copy it?

  8. #23
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    Ok. I figured that out. How would I change it so the results are not displayed below rather you click a button to launch the query in a another tab?

  9. #24
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    OK, I have to ask... Why do you open the query rather than using a form? It is better to view in a form.

    Having said that, to open the query filtered will take more code. It will take a few minutes to modify the code.. (people still bother me with work )

  10. #25
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    Thank you a ton for your help.

    I would just rather have it open in a new window then the search window. I need to add the ability to search by dirffrent fields on this form and I don't want it to be crowded. Can it be opened in like another table form?

  11. #26
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    As you wish..

    How is this?

  12. #27
    SteveFlash is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    39
    Awesome. So would this be easy for me to copy what you did here and change it over to another database? I had to change some of the fields to protect privacy. Do I just need to upload my two table and then change the names in the Macro?

  13. #28
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sure. If any of the object names change, check box names, the query name and/or the table names, you will have to change the code. As long as you understand what the code does, it is easy to import and adapt the code.

    I have to say (again - sorry) that it would be better to use a form than open a query. It is easier to filter a form; you can still sort on different fields...
    But as long as you are happy with what you have, I'll be happy too.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filter data by number as text column.
    By msadiqrajani in forum Access
    Replies: 14
    Last Post: 08-15-2012, 02:34 PM
  2. query column not populating text box.
    By mejia.j88 in forum Queries
    Replies: 2
    Last Post: 02-23-2012, 02:48 PM
  3. How to use checkbox when column > 0?
    By PoorCadaver in forum Access
    Replies: 6
    Last Post: 10-25-2011, 07:50 AM
  4. filter report by query row and column
    By usmcgrunt in forum Access
    Replies: 4
    Last Post: 04-13-2011, 06:52 PM
  5. Checkbox filter on a form
    By aletrindade in forum Access
    Replies: 1
    Last Post: 12-02-2009, 06:22 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