Results 1 to 4 of 4
  1. #1
    KevinH is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    18

    Query and form help

    I created a quesry to find just the information I need, now I would like to put a control in my form that will open a record produced from this query. How can I go to a certain record from the query result?

    Thanks


    KH

  2. #2
    Ryan is offline Novice
    Windows Vista Access 2003
    Join Date
    Aug 2009
    Location
    Lafayette LA 70592
    Posts
    26

    Lightbulb

    Someone ask this recently, they wanted the Mall # as a control.

    Make a Table, lets say MALLTable, with the Names / Numbers you want

    Make a Form, lets say : MALLS
    On this form, make a combobox. The combo box will let you pick your table MallTable. Then you can say pick, Mall Number.
    So on your main form, you have a drop down box with all mall numbers.
    (((If you right click the Combobox-you get propertys, it will give you a Comb#, you will need this later. Example: Combo24))) While the property menu is up for the combo box, Click Data tab, Find Bound Column and change the number from 1 to 2.


    Make a Query, with the fields you want from the MALLTable.
    (((We made the combobox pull Numbers from the Table)))

    Edit the Query in design view, you will see there is a line for Criteria. Here is a example of what you would put in. [Forms]![MALLS]![combo24]
    ===The [Forms] is telling the query, the data it needs to find is on a form, then the [MALLS] is the name of the Form, lastely the [combo24] is the name of the Combobox. that you can pick from on the drop down. So when you run this query, your query will look at the Form Mall for the data.

    Now, getting closer to being done. Make a new Form, based on this Query you just made. Make it as a DATASHEET. (call it something so you know what it is for like : MALLSubform)

    Now, open the main form MALL. Insert SubForm, and pick from existing forms. Pick the Form you Just made (MALLSubform).

    While your editing the Main Form, Click Command button, Make the command run the query you made.

    Done, with options to add.

    If you right click the Command button you made, it has filter/Sort on it. It will display everything on the page you have (SubForm, on the main form)
    The query may pop open a new window. If right clicking is annoying, it is to me. Make a macro that runs the command, Show All Records. Once you make a macro, you can go back to the Main Document, Make a new command button, and make it run the macro instead.

    Each time you load your Main form, pick from the drop down list. Run the query, or macro for ShowAllRecords. And it should display on the Subform.

    ONLY the ones with the DATA you selected will appear. For example, you have 40 malls, and each had a number. You picked 37, Only the data for mall 37 will show up!

    I know its lengthy, but I had a hard time grasping it with shorter versions, hope this helps!!!!

    P.S. If it works for you, dont for get to hit solved! ;p

  3. #3
    KevinH is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    18
    Is there a way to have a combo box in my current form access the query I already have and then open a record for the available results from this query? If I create a new combo box it does give me the option to find a record from a table but not a query, any way to find from a query?

    Thanks,
    KH

  4. #4
    Ryan is offline Novice
    Windows Vista Access 2003
    Join Date
    Aug 2009
    Location
    Lafayette LA 70592
    Posts
    26

    Lightbulb

    Is there a way to have a combo box in my current form access the query I already have and then open a record for the available results from this query?

    The Combobox is directly related to the Criteria in the Query(as in the query looks at the form you already have using the proper criteria statement). As in the Example, instead of using the Mall Senario, supplement those names with yours. : instead of [Forms]![MALLS]![combo24]
    yours would be more like

    [Forms]![The Name of your From goes here]![comboX] I used X as a way for you to see you need to get that number from the Form you have it on.

    If I create a new combo box it does give me the option to find a record from a table but not a query, any way to find from a query?


    What exactly are you trying to pull from the query? or just Sort it? If its more specific Data, we can add additional criteria to the query.
    Last edited by Ryan; 09-04-2009 at 08:13 AM. Reason: Note:

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

Similar Threads

  1. Query To Form
    By RyanPRomero in forum Queries
    Replies: 1
    Last Post: 08-29-2009, 07:58 PM
  2. Use form data in a query
    By Zholt in forum Forms
    Replies: 2
    Last Post: 05-13-2009, 07:59 PM
  3. Update Query from Form
    By ste_pie87 in forum Queries
    Replies: 2
    Last Post: 04-26-2009, 07:22 PM
  4. Query expression for form
    By pjacob in forum Forms
    Replies: 1
    Last Post: 10-10-2006, 09:12 PM
  5. Form field not displaying in query
    By Valeda in forum Queries
    Replies: 2
    Last Post: 05-05-2006, 10:08 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