Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Which control was clicked? (Access 2003)

    Hey all,

    I have a form with a subform. The subform is a datasheet, and on the form are the options for sorting and filtering the datasheet. All nice and well. BUT...

    I would like my users to be able to sort and filter the subform and for those changes to be reflected in the main form, as if they had picked them from the main menu.

    Currently I'm doing it by code in the Exit of each control in the subform, like this:

    Private Sub Name_Exit(Cancel As Integer)
    Forms!frmMain!cboSort.Value = Me.OrderBy
    End Sub

    But I was wondering if there were a global way of doing it (as opposed to checking each control individually)? Originally I tried to use the Current of the form, which is fine if users only sort and filter in the subform, but if they choose from the main menu then I get an error and I can't seem to figure out a way to distinguish between the two. The dirty property doesn't work (I get an error), and I can't find an exit event to check.

    Any ideas?

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

    Re: Which control was clicked? (Access 2003)

    You can use the Apply Filter event of the subform to perform an action when the user activates, changes or disables a filter.
    But there is no "On Sort" event that occurs when the sort order is changed. I don't think there is an easy solution for that.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Which control was clicked? (Access 2003)

    Thanks, Hans. I was afraid of that.

Posting Permissions

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