Results 1 to 12 of 12
  1. #1
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Query Criteria (2000)

    A column in my table has a number of different categories. How do I select one of those categories and use it as criteria in a query?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Query Criteria (2000)

    I'm not sure I understand your question, but ...
    By column, I presume you mean what Access (in .mdb or Jet files) calls a field. If you have several categories, I assume some records have one category, others have different ones. To select just one category, you put the category value in the criteria box for that field in the query grid. If you table stores it as text, then you put text in the box - if you use a look-up table and store a number in the field, then you also put a number in the box. Hope this makes some sense to you.
    Wendell

  3. #3
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    Wendell,
    MyTable has a field with several records. On MyForm is MyListBox, I want to select a record from MyListBox dropdown list [from MyTable] and use it as Query Criteria.
    Thanks, John

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    If I understand your question correctly, you can refer to the list box selection in the query by placing:
    [Forms]![MyForm]![MyListBox]
    on the criteria line of the query grid in the appropriate column.

    MyForm must be open when the query is run so that it can "see" MyListBox.

  5. #5
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Query Criteria (2000)

    Thomas has it dead right - should work like a champ.
    Wendell

  6. #6
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    Thomas,
    I placed code in the query grid as instructed but when I called the Query, a window still appears awaiting a parameter. Why?
    MyTable was open and MyListbox had the selected record in view.

    John

  7. #7
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    Make sure the form is open and the list box has the value (not record) selected that matches the data in the column of the query grid where you placed the criteria. Check that all spelling, from form to query, matches precisely. If after checking this you still get a parameter window, please tell us exactly what the parameter window is requesting. How are you "calling the query"? Are the listbox and the form bound or unbound?

  8. #8
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    Wendell, You're correct ThomasW is dead right.

    John <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  9. #9
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    Thanks

  10. #10
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    I've run the query and have all the records displayed for that particular PART DESCRIPTION. Now, I've focused on the PART [part number] of one of those records. Is there a way I can use the focused 'cell' to search for that PART and display it in the original Form?

    John

  11. #11
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    When you say "I've focused on the PART [part number] of one of those records", are you looking at it in the datasheet (query results) or somewhere else?
    When you say "display it in the original Form", do you mean display that part number on the form which you initially used to run the query? As I remember, that form was based on a Tooling-Dies table and the query was based on a Parts table, so how can you display the results of the query in the form when they are not based on the same source?

    I apologize, but I do not understand what you are trying to accomplish or which objects you intend to use to accomplish it.

  12. #12
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Query Criteria (2000)

    The initial Form [TBL-TOOLING - DIES] uses Table [TBL-TOOLING - DIES] as it's source (sorry about TBL prefix for both). Table [TBL-Parts] and Table [TBL_TOOLING - DIES] both have field [Part Description] and are identical.
    Query uses Table [TBL_Parts] as criteria for search in Table [TBL_TOOLING - DIES].
    I created Table [TBL_Parts] so that I could reduce the number of records available for Criteria, ARM for ARM and ARMREST etc.
    Now that I have the datasheet and have one 'cell' [Part 'field'] of a record focused, I would like to use that focused 'cell' to search Table [TBL-TOOLING - DIES] via Form [TBL_TOOLING - DIES] and it's appropriate ListBox.
    Clear? - as mud, right?

    This is how I'd like to use this DB:
    1.Check for Dies that produce say, ARM.
    2.View the various results on datasheet.
    3.Choose one of these ARM's.
    4.View all of the other fields of that record from the Form.

    Thanks for your help, John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •