Records in a form in alphabetical order

atticus1802

Registered User.
Local time
Today, 06:10
Joined
May 5, 2010
Messages
43
This maybe a stupid question but is it possible to sort records so they appear in alphabetical order in a form. I can do this if I have the name of the company as the primary key but I do not want to do this.
 
Your forms should be bound to queries rather than directly to a table anyway. You can set the sort order in a query.
 
If it's based on a query, just sort ascending in the query's design. If a table, sort by the column you want sorted in datasheet view and save. The saved sort should be reflected int he form.
 
Queries are far more powerful and flexible and avoid some of the locking issues that binding directly to tables can cause.
 
Depends what you want I suppose..... horses for courses and all that

Good weekend all!
 
Ok thats what I thought I have built a query however is there an easy way to switch the control source of the textboxes/comboboxes from one table to a query seeing as the control source only lists values in that table.
 
Easiest way is to keep the names the same and just change the record source of the form.
 
Same way you selected it in the first place. In form design, open form properties, first option.
 
You've not selected the form then - use the drop down box above where you're looking and select 'form', I'm sure it's 'record source' for forms and 'control source' for certain objects....
 
No worries, hope it's OK now....!
 
What if my combobox shows all the reports I made? I want my reports to be in alphabetical order so it is easier on the user. This is my code to list all of the reports:

Private Sub Form_Load()
Dim ao As AccessObject
For Each ao In CurrentProject.AllReports
Me.Combo9.AddItem (ao.Name)
Next
End Sub

I can't create a query using the names of my reports, can I? Any help would be appreciated
 
I would use that code to store the names of your reports in a table, (which you will need to update as you add new reports - but this is a design issue, not a run-time one) - then you can use a query based on a sorted version of the reports table

in actual fact, the report names may well not be so useful anyway. I would be inclined to add another column, with a descriptive name, and use that to let your users select the report

eg
Sales Report is clearer than repSummarySales, say.
 
How would I go about doing that?

And my report names are already descriptive.. They are names of customers
 

Users who are viewing this thread

Back
Top Bottom