Sorting on a form

mar1331bro

New Member
Joined
Jul 15, 2006
Messages
6
How do you sort on a field (text box) that is created on a form that is not part of a database. Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,352
I think I might have an idea what you mean, however, I'm a little confused because of some of your terminology.

Think of this as - the process my mind went through to translate your sentence. And yes, I could be an idiot.

"not part of a database" - I think you mean it's not data that exists as records in a table. This is what is called an unbound control or unbound text box.
The term field is used almost exclusively as a field in a table or query. Field is actually an Access term - a more generic word would be Columns that's used in most of the rest of the database world.

Another point is, most of the time that somebody wants to sort text boxes, they want to sort the data in them, and it's because they're using a form bound to a query or table that happens to display the data in text boxes. This, of course, can't be true because you said it's not part of a database.

However, you could sort the text within a text box but then you'd have to choose on what criteria. Generally, you're going to have to write a code module that grabs the text and then parses the word into an array and then puts them in order. There are a variety of simple sorting techniques that should work.

If it's actually a combobox or list box, you're going to have to do the same thing, however, walking through the text will require a slightly different technique to reference each item in the list.

If you're actually in (laymans term) the viewpoint that looks a lot like a spreadsheet - you are no longer actually working with a textbox. Sorting it is as simple as clicking on the header fields and making it sort.

There are other questions I might ask, however, that's a lot of speculation. More details would let us get more specific.

Mike
 

Forum statistics

Threads
1,136,369
Messages
5,675,360
Members
419,565
Latest member
Phil57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top