Stuttering Loads

MatthewB

Member
Local time
Today, 06:08
Joined
Mar 30, 2022
Messages
85
I have a continuous form. I put: DoCmd.SetOrderBy "[StrataPlanNr],[ServiceLines]"
to sort the form when it loads.
There is something wrong with this code.

Q1: What?
Q2: Is there a depository of documentation from Microsoft or others about the syntax for such statements?
 
If you want to order the data, put the order by in your query.
 
Or you can use the form property sheet to sort the data if you prefer

1655654712837.png
 
If the form's Orderby runs AFTER the form is loaded, then Access has to process the RecordSource twice. Therefore, sorting in the RecordSource query saves a step. If you want to sort on command later, then use the OrderBy property.
 
I am using a foreign key to set a field that is part of the ordering. As it is a number I am guessing it is sorting numerically (the kp value). What would I need to do to make this sort alphabetically?
Thanks
 
If there is a text field associated with the FK, you would write a SELECT query to JOIN the table you wanted sorted with the table that contains the translation of that foreign key. Then you would sort the query on the text field that you brought in using the JOIN.

Code:
SELECT A.F, A.G, A.H, B.HName FROM A INNER JOIN B on A.H = B.H .... (if you had a WHERE clause, it would go here) ... ORDER BY B.HName;
 
I am using a foreign key to set a field that is part of the ordering. As it is a number I am guessing it is sorting numerically (the kp value). What would I need to do to make this sort alphabetically?
Thanks
If you make it sort alphabetically by making a string, then it would not sort as you think it should? :(
 
Gasman, I think the question was about sorting by the text field rather than the ID field.

@MatthewB If you are using a table level lookup, you should consider removing it. They are a crutch for people who don't know how to write a query with a join. They also obfuscate the data. You look at it and you see text but you sort and the sort is on the hidden ID. I don't think that is user friendly. And it is only one of the many problems you encounter.
 

Users who are viewing this thread

Back
Top Bottom