Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subreport link to userform text box (Access2003)

    I have a userform with a listview control which can be multi-selected.
    When the report is opened, I put the listview values into a text field on the userform (as well as a field on on the report).
    I have a query behind a subreport that references this field. However, it doesn't return any results.
    Am I doing something wrong?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreport link to userform text box (Access2003)

    Please provide more detailed information - how do you fill the text box, how do you use it in the query?

    BTW, do you mean a list box? A list view is not a native Access control.

  3. #3
    New Lounger
    Join Date
    Oct 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreport link to userform text box (Access2003)

    I set up the text box from the checked items in the listview. For example, the text box displays all the items checked and puts the in before it - "in ("cats", "dogs")" .
    In the criteria for the query it has the reference to the form, eg: "Forms!FrmName!txtBox"

    If I type "in ("cats", "dogs")" into the query it works perfectly. However, by referencing the text box it never returns any results.

    However, if the text box just contains one of the items ("cats"), then the report does work.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreport link to userform text box (Access2003)

    You cannot treat In ("cats", "dogs") as if it were a string; it is an expression that contains strings.
    See How to Create a Parameter In() Statement for two ways to handle such a condition. You'd have to replace the parameter prompt with a reference to the text box, and fill the text box with a comma-delimited list of selected items.

  5. #5
    New Lounger
    Join Date
    Oct 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreport link to userform text box (Access2003)

    Thank you Hans - it all works perfectly now. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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