Sort order in a subform (1 Viewer)

PulseTeqUser

Registered User.
Local time
Today, 23:31
Joined
May 2, 2017
Messages
15
I hope someone can help. I have a form for entering orders. It has a subform with a record for each item entered. When I look at the resulting Purchase Order the records from the subform are in the wrong order - with the last line entered displayed at the top. How can I get it to look the same as when I entered it?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:31
Joined
Feb 19, 2013
Messages
16,553
databases store records randomly, regardless of order of input. If you require a specific order you need a field to use for that order and then order by that field.

The usual method for this for user input is to have a timestamp field - just a date/time field with a default value of now(). it does not need to show on the form, or even be brought through in the recordsource query - but you do order the records using it in that query

You could use the ID field if it is an autonumber instead, but it is less reliable since the only guarantee is that it is unique - it does not necessarily mean it will always increment by 1.
 

PulseTeqUser

Registered User.
Local time
Today, 23:31
Joined
May 2, 2017
Messages
15
I thought that would probably be the way to do it but I can't get the field to populate and it shows on the form even though I have set the Visible Property to No
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:31
Joined
Feb 19, 2013
Messages
16,553
you are probably using layouts - just delete the control from the form.

To populate the field, you should have set the default value in the table to Now() - it will populate when the record is saved
 

PulseTeqUser

Registered User.
Local time
Today, 23:31
Joined
May 2, 2017
Messages
15
Thank you for your speedy response. I am now getting the field populated! Just got to work out how to do the sorting - afraid I am very new to all this.
 

Users who are viewing this thread

Top Bottom