Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    18

    Unanswered: Need to show how many records result from query

    Hi all!

    I have a form (based on a table) wherein there is a list box populated with records from a query. On the form, I need to include a text box that shows the how many records are in the record set resulting from that query. I would think this should be simple to achieve, but I’m not coming up with it.

    What I know of Access has been by trial and error out of immediate necessity, since building databases is only a small portion of my varied responsibilities. The assistance of those more experienced than I am is greatly appreciated!

    Thanks in advance,

    sykayda

  2. #2
    Join Date
    Oct 2002
    Location
    Inland Northwest(US)
    Posts
    19
    A brute force approach would be to open the query as a recordset and then counting the # of entries in a particular field.

    Laeskia

  3. #3
    Join Date
    Sep 2002
    Posts
    18

    Cool

    Thanks, Laeskia!

    Perhaps not the most efficient way of doing it, but because of the way the whole thing works, I ended up creating a new query in order to count the records and used a subform to display the results. Everything works smoothly now. Don't know why it caused me the frustration it did.

    Thanks for your assistance!

    sykayda

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    great if it works for you, but there is a sweeter way:

    YourAnswer = DCount("[aFieldNameInYourQuery]", "yourQueryName")

    There's a bunch of these domain functions (max, min etc etc) that are really useful... well worth investigating!


    izy

  5. #5
    Join Date
    Sep 2002
    Posts
    18
    Must be that pre-full moon mind numbing!

    I had tried that (before I resorted to more cumbersome methods), and I must've been making some stupid little mistake that I just wasn't seeing, 'cuz it wasn't working. Now it's behaving perfectly, as I suspected it should.

    I'm relieved to know it was some error of mine; I was beginning to think I didn't understand how to use the functions.

    Thanks, izy!

    - sykayda

Posting Permissions

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