Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parameter queries (XP, 2000)

    I have two questions about a parameter query:

    1) I have a subform that displays the results of a parameter query. Problem is, when I open the main form, the parameter box pops up asking for the parameter. I would like to stop this as the query should only be run on demand - not automatically. I thought there was some way I could connect it to a command button or have a parameter text box on the form.

    2) Same query - it works well so long as I only query one table. However, there is a second table that contains multiple records for each record in table 1. I would like to display the query results such that the records in table 2 are counted for each of the table 1 records returned in the query. Something like below where collecor is in one table and a list of coins and owners is in table2:

    Collector............Coins
    John...................12
    William...............25
    Mary....................35

    I found that when I include table2 in my query, even having established the relationship between like ID fields, the query returns nothing.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parameter queries (XP, 2000)

    1) Why is your subform based on a parameter query? If you link the subform to the parent form using master/child links, there isn't any need for a parameter query. Subforms load first, so the parent form hasn't yet loaded its recordset when the subform prompts for the parameter query. If you don't want the subform populated at load, remove the sourceobject from the subform control and set it in code later. However, you're still going to have problems if the subform is based on a parameter query. I see no reason to only load the subform on demand. That is counter intuitive and much harder to implement than simply using the master/child links. You're making work for yourself.

    2) You should link to a totals query on the table, not to the table itself. If you use an outer join between the key field in the table and the query, it should work. However, if you want real help, you'll have to post the SQL that is not working.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter queries (XP, 2000)

    I solved the count problem. Thanks for the inspiration.

Posting Permissions

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