If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
alphabetical order of reports in a listbox
i have this code on my list box:
This displays all the reports i have with "rpt" & "rpf" word at the beginning of the report name. 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 my problem is, i want to display the reports in alphabetical order. How can i do that? thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200909/1 |
#2
|
|||
|
|||
alphabetical order of reports in a listbox
imstuck wrote:
i have this code on my list box: This displays all the reports i have with "rpt" & "rpf" word at the beginning of the report name. 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 my problem is, i want to display the reports in alphabetical order. How can i do that? thanks i also tried this: SELECT [Name] FROM MsysObjects WHERE (([Type] = -32764) AND ([Name] Not Like "~*") AND ([Name] Not Like "MSys*")) ORDER BY [Name]; -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
alphabetical order of reports in a listbox
Try:
SELECT Mid([Name],4) As RptName FROM MsysObjects WHERE [Type] = -32764 AND Right([Name],3) IN ("rpt","rpf") ORDER BY Mid([Name],4); -- Duane Hookom Microsoft Access MVP "imstuck via AccessMonster.com" wrote: imstuck wrote: i have this code on my list box: This displays all the reports i have with "rpt" & "rpf" word at the beginning of the report name. 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 my problem is, i want to display the reports in alphabetical order. How can i do that? thanks i also tried this: SELECT [Name] FROM MsysObjects WHERE (([Type] = -32764) AND ([Name] Not Like "~*") AND ([Name] Not Like "MSys*")) ORDER BY [Name]; -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|