Results 1 to 3 of 3

Thread: How Many

  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    How Many

    I have a subform that retrieves records based on an order ID. Initially, I would have 1 item per order. Most of the time, there would only be 1 item. Sometimes there may be a need for another, so I provided a button to allow adding another item.

    There are certain checks that I want to do on the fields. However, these checks would only be done (or done differently) if there is >1 record in the retrieved set.

    Knowing the current record is OK if I'm in the case with multiple items and currentrecord is >1. However, I also might be on record 1 with multiple records. Or I might be on record 1 with only 1 record. The check needs to distinguish these 2 cases. In summary, I need to be able to
    distinguish:
    - multiple records regardless of which regard I'm on (first or any other)
    - one record only

    Thanks.

    Fred

  2. #2
    Star Lounger
    Join Date
    Feb 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How Many

    From the subform you can do this:

    If Me.RecordsetClone.RecordCount > 1 Then

    From the main form you can do this:
    If Me.[frmMySubform].Form.RecordsetClone.RecordCount > 1 Then

    The handy thing here is you don't have to move through the recordset before you query RecordCount.

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: How Many

    Marty,

    Thks for the tip.

    Just have to remember to place those statements after an Me.Refresh so that the count includes a new record if I'm working in one.

    Fred

Posting Permissions

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