Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004

    Unanswered: Using form input to modify query

    What I want to accomplish:

    - User opens form, selects value from combo box
    - combo box value changes criteria in query
    - Subform lists query results based on that criteria

    What is the simplest way to do this? I thought this would be simple but I haven't been able to figure this out. I have a lab book with examples of different forms and queries, but nothing about interactive query based forms.

  2. #2
    Join Date
    Apr 2006
    tried it out, but had to address the subform's target form itself
    and use filter property instead

    cmbCriteria onchange

    actualsubformname.filteron = true
    actualsubformname.filter = "field = " & "'" & cmbCriteria.column(1) & "'"

    luckily for you
    ...along came the master of access saying that

    point the subform's query to the particular value of the combo box
    then place a subform.requery on the combo box's onchange event

    this would be the criteria in the subform's query

    both methods worked fine, but of course, the master's method is more concise

    yup, I'm the novice
    Only quitters quit!

  3. #3
    Join Date
    Feb 2004
    I'm having trouble with this... it sounds simple enough, and I'm referencing my form's combobox in the queries criteria. I tried several different ways of refreshing the form and query and nothing changes. I still get my query without criteria.

  4. #4
    Join Date
    Feb 2004
    Ah, nevermind, I got it. For some reason during my testing, I messed up and was loading my subform using the table directly instead of the query that had the combobox as criteria. And instead of using a requery, I needed to use a refresh.

    Thanks for all your help!

Posting Permissions

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