Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Control Number of records being deleted in subform (A2003)

    Hi All,

    I have Continuoussubform of transactions, the user can delete transaction lines as required and I can stop them deleting single lines if certain criteria is not meet in the form delete event. If they use the record selector's it allows you to select more that one record at a time and effectively them delete more than one record at a time.

    My problem is how can you stop them deleting more than one selected record at a time in a Continuoussubform?
    Is it possible to tell how many records are selected when/as they delete them so I can stop them if there is more than one?

    Thanks in advance
    Cheers
    Tony

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Control Number of records being deleted in subform (A2003)

    The easiest way would be to set the RecordSelectors property the form to No.

    Otherwise, you can use the following code in the form module:

    Private Sub Form_Delete(Cancel As Integer)
    Cancel = (Me.SelHeight > 1)
    End Sub

    SelHeight is the number of selected records. If this is greater than 1, the delete action is canceled.

  3. #3
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Number of records being deleted in subform (A2003)

    Thanks Hans

    I'll try the SelHeight option first and see how I get on.

    Cheers
    Tony

Posting Permissions

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