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

Queries

Get selection criteria from a form by elizabeth
Posted: 8 Jun 00

When you have selection criteria for more than one field in a query, or you would like to give the user a combo box to select the criteria from, here's how to build a form to collect the input and then refer back to those values in the form.

1. Say you have a table with two fields (Table1, FieldA, FieldB).
2. Create a blank form with no underlying table or query (Form1).
3. Add 2 comboboxes (cboValueA & cboValueB) to your form using the wizard.
4. To write your query, go into design view for a new query.
5. Click on the View button (the leftmost button) on the query toolbar.
6. Paste in this SQL statement:
    SELECT Table1.FieldA, Table1.FieldB FROM Table1
    WHERE (((Table1.ValueA)=[forms]![Form1]![cboFieldA])
    AND ((Table1.FieldB)=[forms]![Form1]![cboFieldB]));

7. Click on the Design View button again to return to the Grid and close (save) the query.
8. Open Form1 and drag a button to your form using the wizard
9. Select Miscellaneous, Run Query, Query1.
10. Test! Test! Test!

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