Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316

    Unanswered: Counting records in a sub-form.

    How can I count the number of records in a sub form (from within the parent form), whose record source is a query? Ideally I need to do it through code. I can't seem to find a way using RecordCount or RecordSetClone.

  2. #2
    Join Date
    Oct 2002
    Posts
    48

    Select statement

    When you are in parent form, for particular parent record, Sub form's records are getting changed. Because there is a relationship.

    There are certain fields are passed to sub form to pull certain records in subform.

    Write a following code in parent form.

    ---

    Dim DB as database
    Dim RS as recordset
    Dim SubformRecords as integer

    Set DB = currentDB

    Set RS = DB.Openrecordset("select count(*) from Subform_table_query
    where parameter_filed = Me.field")

    SubformRecords = RS(0)

    ---

Posting Permissions

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