Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004

    Unanswered: Using VB Code, how to filter records from a query underlying a crosstab query?

    Posted this on Usenet, but had no responses - hoping I have better luck here...

    I am trying to create a report that uses a crosstab query as its recordsource. The crosstab query in turn is based on another query. My question is how to filter records (via VB Code) from the underlying query? (i.e., the fields I want to filter by do not appear on the crosstab so am trying to figure out a way to do the filtering (using a form's listbox) with the query that underlies the crosstab query. Thanks in advance for replies.

  2. #2
    Join Date
    Apr 2004
    Derbyshire, UK
    Provided Answers: 2

    In the criteria section of the field to be filter in of the stored query (that the crosstab is based on), put a reference to the listbox control on the open form.

    ie Forms![frmName]![lstBoxName]

    Note, the value of the Bound Column (not necessarily the visible value) of the listbox should be compatible with the field being filtered.

    Also, this will limit the use of this query (and the crosstab) to that specific form !



  3. #3
    Join Date
    Dec 2004
    Thanks MTB,

    Would that work for criteria from multiple boxes? - there's more than one field that I'd like to filter, and some listboxes are set up for multiple selections. Thanks for 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