• Which control was clicked? (Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Which control was clicked? (Access 2003)

    • This topic has 2 replies, 2 voices, and was last updated 17 years ago.
    Author
    Topic
    #449239

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #1100916

      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.

    Viewing 0 reply threads
    Reply To: Which control was clicked? (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: