Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    55

    Talking Unanswered: RecordCount and Subforms

    I have a form (information) and subform (categories for information).

    The Information record can be have multiple categories assigned to it.

    The problem is that if, for example, there are 3 categories assigned to the information record, the record count will count each instance of the category and show "1 of 3" for the form when it should be "1 of 1" with 3 categories on the subform.

    Scrolling through the 3 records will display the same record 3 times.

    Is there a way in VBA to make the form only show unique instances of information rather than an instance multiplied by the number of categories?

    TIA

    Hirk

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    I assume it's rather a problem of your data source than from vba. When having a form/subform combination the main form should only select from the master table. Example:

    lets say we have 2 tables Item and Category.

    joined it would look like:

    SELECT Item.something, Category.morestuff
    FROM Item INNER JOIN Category ON Item.ItemID = Category.ItemID;

    but when using subforms your main form would just have:
    SELECT something
    FROM Item;
    and the subform:
    SELECT morestuff
    FROM Category;

    by setting the link from and link to properties of the subform control to ItemID everything will be done for you...

    hope this helps

Posting Permissions

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