473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Sort Alpha Order in Form Incorrect when Source Table is Correct

I have a form in Access 2010 that is feeding from a source table where the columns are correctly sorted in alpha order. I created a form using unbound combo boxes using the table as source. When I click into Form View, the dropdown from the combo boxes are not sorted the same way as the source table. I need the dropdowns to be in alphabetical order. How can I do this without breaking the link between the combo box and the source table and relinking?

Thank you
Dec 26 '13 #1
8 3221
jimatqsi
1,271 Expert 1GB
Look at the Data tab on the properties of the combo box. You will see that you can define a query to fill the combo box that is completely independent from the table. You can sort the combo box entries any way you like.

Jim
Dec 26 '13 #2
Thanks for your help Jim - I am still new to Access, can you please elaborate on what you mean? The form is feeding from a table, not a query. When I click into the Data tab on property sheet, I don't see anything that allows me to sort except Order By and Order By on Load. Order By is blank but Order By on Load is already set to "Yes".
Dec 26 '13 #3
zmbd
5,501 Expert Mod 4TB
accessn00b1:
Two solutions, both basically the same:
Create a stored query based on the table data. In that query include the sort order. Run it to make sure that it has all of the same data that you were using and that it is in the correct order.
Use this stored query as the rowsource for your control.

The other solution is to embed the above query within the control. This is fairly easy to do; however, can make maintaining the database a tad more difficult. You do this, by taking the query's underlying SQL and pasting that directly into the rowsource of the control.
Dec 26 '13 #4
NeoPa
32,556 Expert Mod 16PB
"Order By on Load is already set to "Yes"."
What that means is that the order that the table is in (which isn't as simple as how you see the data when you open it anyway) is ignored and replaced by something else (that we have no information about at this stage).

You may want to look into what that order is, and how it's defined. I suspect when you see what that is you can rearrange it to show the order you desire.
Dec 26 '13 #5
Thanks - is creating a query the only way I can get the data sorted? Is there anything I can do with the table that the form is linking to right now? I would much prefer to not mess with the database and use the table instead of creating a new query.
Dec 26 '13 #6
zmbd
5,501 Expert Mod 4TB
jimatqsi and Neopa
I think what we missed here: The controls are unbound; thus, the form's sort on load and sort by do not count.

accessn00b1:
1) take a careful look at your source table. More than likely, if that looks correct, it's because a sort order was applied to the table.
1a) to confirm in ACC2010:
  • Open the table in normal mode.
  • Click into any data cell.
  • In the Ribbon, you should see a new tab called "Table Tools" click on that tab.
  • There will be a group called "Sort & Filter" look carfully to see if either of the "Ascending," "Descending," options are highlighted, or if the "Remove Sort" option is available - if true, then there is a table level sort order. This sort order will not translate to the control.
2) The only ways that I know that you can set the sort order for the rowsource of either a listbox or combo box is to:
  • Enter the list by hand/vba in the order you want. I only recomend this for very short lists that do not update often, if ever.
  • Rework the data table such that the lowest primary key has the correct first item in the list, 2nd lowest the second item, and so forth. I also do not recomend this because it is a pain to maintain and potentially breaks the referential integrity of the database. Insert here, insert that, make sure that everything translates down, and then what, things you referenced may also need changes... YUCK!!!
  • Use a query as in post#4

ALSO, Keep in mind - the ROW SOURCE does NOT equal the CONTROL SOURCE! These are two, seperate properties of the control! The only relationship between these two properties is the bound column and that must return a value that is valid for the control source.
Dec 26 '13 #7
NeoPa
32,556 Expert Mod 16PB
Good spot Z. I missed that the property values being given to us were of the form rather than the control in question. I'm still quite unfamiliar with newer versions of Access so didn't realise that wasn't even a control property (and my Access 2010 install has gone down the tubes on me so couldn't even check :-().

@accessn00b1
For your List- & Combo-Box controls, if you want to keep it linked to the table itself rather than some saved query, you can use some simple SQL code in the Row Source property (The Row Source Type can stay as "Table/Query".) :
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM [YourTable] ORDER BY [Field1], [Field2]
This simply replaces whatever you had there as the table name :
Expand|Select|Wrap|Line Numbers
  1. YourTable
I suspect this is what Z was referring to in his post #4.
Dec 26 '13 #8
jimatqsi
1,271 Expert 1GB
I need to spend some time with the 2010 version. Thanks, zmbd

Jim
Dec 27 '13 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Uwe Range | last post by:
Hi to all, I am working on a form with a combi-field on a subform. I want to give the user the opportunity to alter the list-content (which is based on a table) in a separate form. The user...
2
by: MLH | last post by:
I have a form frmEditAdminData. Its AllowAdditions property is set to No. I thought this meant the form could not be opened in a manner that allowed the appending of new records to its source...
8
by: kaosyeti | last post by:
i have a (hopefully) small problem. i have created a system where a user enters customer information into a table through a form. this table has no primary key. there are 9 fields on the form to...
8
by: TORQUE | last post by:
Hi, I am having some trouble with recording a field on a form into my Table after formatting it to calculate several fields on the form. If i just put the amount in the field and have it linked...
1
by: accessbee | last post by:
(Sorry this is so long, was trying to fully explain the situation) There are two tables that handle information on our clients. Every client has a unique ClientID, and the ClientID is the Primary Key...
5
by: hlebforprimeminister | last post by:
Hi I am creating a purchase order form in access. I have to create a single form to enter the information into 3 different tables (let's call X, Y, Z). Each of these tables has an autonumber...
1
by: Deccypher | last post by:
Hi I am trying to give my customers an option to save favorite products for easy storage and reorderig. it works great and on the single item add to cart i have no problem, how ever i would also...
7
by: chrismaliszewski | last post by:
Hi. I created code which makes dynamically form with bounded controls for all columns. I show it to you below. My problem is, how I have to change this code to create form which record source...
1
by: JonHuff | last post by:
I have a form in which users can create new records or modify existing records. All records are stored in one table. I want to be able to keep track of all changes made to existing records as well...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.