INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Howto:

How to Open a Parameter Query or Report from a Selection Form by Quehay
Posted: 9 Jul 00

First you set up the query that you want to view with the following criterion for the field(s) that you want users to be able to select (substituting the actual names of your form and combo box):

[Forms]![frm_QryView]![cboFieldChoice]

The combo box has its RowSource set to the field of the table from which you want to select.  Use the wizard to create the box and only choose to show the field with the parameter entry.

**Understand that you'll visually refer to the LastName etc., field in the combo (it will be in column #2) but Access will refer to the key of that table (in column #1 with the width set by the wizard to "0";", so that it's not visible in the dropdown list).  For this reason make sure that the field in the query is the key/id field of that table, not the LastName, etc. field.

The next step is to create a dedicated parameter form.  Just a small form with its popup property set to true and your combo on it.  Place a button on the form that has the following in the MyButton_Click() event:  

DoCmd.OpenQuery "myParaQuery"
DoCmd.Close "myParaForm"

To deal with user failure to select a value you could have the button.enabled property set to False and the reset to True by the combo_Click() event.  To allow the option of return of all values if the user selects none go back to the query and in the "OR" parameter line below the first parameter entry just put the exact parameter prompt with "Is Null" after it, e.g.,  [Enter the Last Name] Is Null.

You can have the button open a report based on the query just as easily.  Create the report based on the query and change the DoCmd line to DoCmd.OpenReport "myParaReport".

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close