[mso] Access 2002: Form Open Sort Criteria

  • From: Cathy.Evans@xxxxxxxxx
  • To: mso@xxxxxxxxxxxxx
  • Date: Wed, 7 Jul 2004 13:32:44 -0400

The following code is in the open event of my form.  It looks for report
names to show them in a list box.  The underlying query on the list box is
sorted ok but the list box results on the form are not sorted according to
the report name minus the first three characters (either rpf or rpt).
Could this 'open' event be taking precedence over the sort I've got in the
query, and if so, how do I change to cause the list box to sort right?
Thank you!

Private Sub Form_Open(Cancel As Integer)
  Dim objAO As AccessObject
  Dim objCP As Object
  Dim strValues As String
Set objCP = Application.CurrentProject
For Each objAO In objCP.AllReports
    If Left(objAO.Name, 3) = "rpt" Or Left(objAO.Name, 3) = "rpf" Then
        strValues = strValues & Mid(objAO.Name, 4) & ";" & Left(objAO.Name,
3) & ";"
    End If
Next objAO
lstReports.RowSourceType = "Value List"
lstReports.RowSource = strValues

End Sub




-----------------------------------------------------------------------------------------------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential
and/or privileged material. If you are not the intended recipient 
of this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any
action taken in reliance upon this message is prohibited. If you 
received this in error, please contact the sender and delete the 
material from any computer.  Any views expressed in this message
are those of the individual sender and may not necessarily reflect 
the views of the company.  
-------------------------------------------------------------------------------------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts:

  • » [mso] Access 2002: Form Open Sort Criteria