Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms Order By (Access 2002)

    When ever I use the Sorting Functions in a form I noticed that when I close the Form it retains the 'Sorting Value' in the 'Order By' properties of the form. I would like to reset the 'Order By' form property back to 'blank'; the value it was prior to Sorting; I like to do this when closing the form; I tried setting the value by using the following command; Me.OrderBy = OrderBy = " ". However the Value "False" was entered into the 'Order By' property of the form. All I want is the form to open without retaining the previous sorting value.

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

    Re: Forms Order By (Access 2002)

    I always provide a command button on a form labeled "Close". The On Click event procedure for this button closes the form without saving the design:

    Private Sub cmdClose_Click()
    DoCmd.Close acForm, Me.Name, acSaveNo
    End Sub

    By not saving the design, the filter and sort by properties are not stored.

    Note: acSaveNo has no bearing on saving the current record; Access always saves the current record automatically.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms Order By (Access 2002)

    In your statement "Me.Name" refers to which field?

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

    Re: Forms Order By (Access 2002)

    Me refers to the object executing the code, i.e. the form. Name is not a field, but the Name property of the form. Although you could omit Me.Name in most cases, it ensures that you close the form running the code, not the form that happen to be the active form at that moment.

Posting Permissions

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