So this is for Microsoft Office Infopath 2007 (SharePoint 2007).
The situation is that I started creating a SharePoint List (datasheet) and when I made my form dropdown read from the list, it just put elements in the order that I entered them in the datasheet.
Googling this led me to browse MSDN for an hour before I realised all those experts were using programming solutions that seemed a bit over the top for something that should be so simple.
Hey presto, I found a cheat/workaround:
- Click on the list to see your datasheet (has a MS Access icon in the top left to remind you what you're getting yourself into)
- Go to Settings
- Select Create View
- Select Datasheet View (you could probably use a "Standard View", I just used the Datasheet one)
- Give the view a name, select what columns you want the form to have (I included the IDs for functional purposes)
- Further down the "Create View" page, there should be a Sort section, specify the column to sort by.
- Save the view by clicking the OK button.
If you haven't made a dropdown list yet There's other instructions out there on the web but I thought I'd put what I did so that when I did the above it would all work:
- Open your form in InfoPath
- Go into Design mode
- Go to "Controls" and add a Drop-down List Box to your form
- Right-click it and select "Drop-down List Box Properties"
- Under "List box entries" select Look up values from an external data source
- Next to "Data source" click on Add
- Select "Create a new connection to" and then Receive Data
- Select SharePoint library or list
- Copy the URL/web address from your browser which has the datasheet open (eg. "http://your_sharepoint_server_name/Lists/your_list_name/Allitemsg.aspx")
- Select the name of your list (I know I thought we already did this but hey ho)
- Select the fields of this list you want to use (only really need ID and Name or just the one if your dropdown values will be the same as the display labels)
- Next > Next > Finish
- infopath look up values sharepoint list sort by
- order drop-down list box without/no programming code