Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2008
    Posts
    2

    Query Criteria

    I am designing a query in an access database that is linked to a form and report. One of the fields in the query is "department". In my form there is a pull down menu (combo box) with about 20 departments. In my query, I am making the department field have a criteria so that when you run the query, it asks for which department. However, if you do not type the department name exactly as in the list, you do not get any matches. Is there any way when running a query with a criteria to have it ask for a field but show a pull down menu when it asks...so that you don't necessarily have to know exactly how something is spelled?

  2. #2
    Join Date
    Jul 2008
    Location
    Alexandria, Egypt.
    Posts
    38
    Dear Jena,

    You need a drop down list to appear when you run the report to let you select the department vaule ... right??

    I will assume the following names and when you apply you can rename accordingly ...

    Department values located in table "DEPARTMENT"
    Required report name "DATA"
    this report is based on query "QUERY"

    Use the following steps:
    Create a form in design view and insert text box
    Right click and convert the text box into bombo box
    Right click on the combo box and choose properties
    Choose data tab
    Row souce type ... Table/Query
    Row source ... "press the button right to the box (...)
    select DEPARTMENT table
    double click on department field
    close and save

    save and close the form "the form name is DEPARTMENT_FORM"
    open QUERY in design view
    in field department write the following in criteria:
    [Forms]![DEPARTMENT_FORM]![Text1]

    where text1 refers to the combo box in DEPARTMENT_FORM

    open DEPARTMENT_FORM in design view
    insert command button
    choose report operation
    preview report
    next
    choose report "DATA"
    save and close

    open your main form or switch board and inset a command button in it
    choose form operation
    choose open form
    select DEPARTMENT_FORM
    save and close

    now when we press the button in the main form ... the DEPARTMENT_FORM will open
    choose the required department from the drop down list and press the button ... the report will open with the selected values

    Please try and tell me the result

    Thanks

    Ahmed

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

Similar Threads

  1. Query Criteria
    By Texaine in forum Queries
    Replies: 1
    Last Post: 01-24-2018, 02:36 PM
  2. crosstab query criteria
    By Sharron in forum Queries
    Replies: 3
    Last Post: 12-15-2011, 04:31 AM
  3. Query Criteria
    By jena in forum Queries
    Replies: 1
    Last Post: 04-29-2008, 11:00 AM
  4. Need help with tables and query criteria
    By DevintheDude in forum Access
    Replies: 0
    Last Post: 09-12-2007, 08:41 AM
  5. Functions in Query Criteria
    By hraup in forum Queries
    Replies: 1
    Last Post: 10-06-2006, 06:41 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