Results 1 to 4 of 4
  1. #1
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51

    Want to feed query a value from button

    I have a form that I open by a button that is feed by one query. I want to be able to click button and have it open the form but also feed the query a team name so that it only brings records for that team up in the form for adding and editing.

    Not sure how to do this. I currently click button and it opens the form and brings up all the records in the tables for adding or editing. This much works.



    So I need the form to have only the records specfic to the team listed on button

    Thanks for any and all help

    Here is a screen shot. I would like the button to be clicked and it open my one form to those team records. So i would have to feed the query the team name from the button somehow

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Hmmm?
    If you plan on opening Form to a specific record, you might consider formA with a comboBox whose values are teamNames. That is, the rowsource for that combo on FormA is is a list of teamNames.

    When a teamName is selected in the combo, a new form opens (or a subform or other construct) with the details for the Teamname that was selected.

    I'm a little confused with the buttons etc.

  3. #3
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    To answer this question:
    I need the form to have only the records specfic to the team listed on button

    ....and assuming you want to work with one generic form

    Then you need a text field in your form. When you press the button - it writes the team into that text box.

    Next it opens the form. So the button code is:

    me.TextBoxName = "teamname"
    docmd.openform etc etc

    each button enters a different team name of course

    The form itself is sourced to a single query. This query has criteria of that form's text box. In the team name field of the query - for the criteria you have:
    Forms!FormName.TextBoxName

    Once everything works you can make the text box on the form not visible if you wish.

  4. #4
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    A button per team, fed to the same query is not the way to go. Use a combo, and pass the user's selection. Having to add a button (or edit it) per team is bad design. You shouldn't have to modify your form based on changes in your data.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. RSS Feed Auto refresh
    By Ryan455 in forum Modules
    Replies: 2
    Last Post: 03-01-2018, 08:39 AM
  2. RSS Feed?
    By dhicks in forum Access
    Replies: 0
    Last Post: 07-14-2017, 10:26 AM
  3. Replies: 3
    Last Post: 05-23-2017, 07:36 AM
  4. Add RSS feed to a report
    By bid19123 in forum Reports
    Replies: 1
    Last Post: 04-28-2016, 01:36 PM
  5. Importing data with line feed
    By wlcummings in forum Import/Export Data
    Replies: 10
    Last Post: 05-18-2011, 12:52 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