Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Order by Records by two or more fileds displayed

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello.<br><br>I have three or four fields on the form, which should be displayed in accedning order as you scroll through the record selectrs.&nbsp;&nbsp;All three are the fileds from the same table on which the form is based.&nbsp;&nbsp;Can it be done through the Order by property of the form?&nbsp;&nbsp;Your help is apretiated.<br><br>Regards.
 
You should be able to &quot;Order By&quot; in the recordsource of the form.<br><br>Go to design view of the form<br>If the properties window is not open, open it (View ¦ properties)<br>In the Record Source property, select the elipses (...) (Query Builder) button<br>Go to the field(s) you wish to sort by,<br>Select ascending<br>close and save<br><br>You basically just made the record source of your form, a SQL statement instead of a table. You can't order by if you are using a table, as the records will show up in the order they were entered into the table. In an SQL statement, you can have any valid SQL syntax. <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
I'm having the same problem. I have a table that consists of only 4 fields (Date, Payable To, Category & Amount). Payable To and Category are based on lookups that I have added within the same table. I've created a form for data entry, and I absolutely cannot get these to sort in ascending order. I tried the above, and it didn't work for me, so apparently I'm doing something wrong. Any help with this would be appreciated!
 
In Jim's example, his assumption was that a table was being used as the RowSource for the form. If your comboboxes are using a ControlSource that uses a lookup (or verification) table and is bound into a field on the table or query you should be able to set any field you want as an ascending sort order by following the previous recommendation. Remember that the field you want to be sorted first MUST be in the first column of the query, then the field you want sorted second would be in the second column. If you don't do this then Access assumes it knows which sort order you want and helpfully fills your request. Another thing can sometimes confuses the issue is that if you use a text field to represent a number, such as &quot;123456&quot; you will NOT get a numeric sort but a text sort.

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top