Form Not Sorting!!

G

Guest

Hello All,

I have been pulling my hair out on a simple problem. Hoping someone here
has the anwer. I am trying to sort a field on a form by coding it's "on
open" property. The field is a combo box. Here is the code:

Me.OrderBy = "Occurrence ASC"
Me.OrderByOn = True


It appears to group the same words into groups. However, the entire list is
not sorted in ascending order. Any help would be appreciated.

Regards
L
 
G

Guest

Try this:
Me.OrderBy = MyRecordSet![Occurrence ASC]
This assumes Occurrence ASC is a field in your recordset. By the way,
spaces in names is always a bad idea. Consider OccurrenceASC or
Occurrence_ASC
 
G

Guest

Ok I tried that and it gave me an error saying MyRecordSet not
defined...Also, there is no sace...Occurrence is the control source and ASC
is the sort order...

Klatuu said:
Try this:
Me.OrderBy = MyRecordSet![Occurrence ASC]
This assumes Occurrence ASC is a field in your recordset. By the way,
spaces in names is always a bad idea. Consider OccurrenceASC or
Occurrence_ASC

Lowrider72 said:
Hello All,

I have been pulling my hair out on a simple problem. Hoping someone here
has the anwer. I am trying to sort a field on a form by coding it's "on
open" property. The field is a combo box. Here is the code:

Me.OrderBy = "Occurrence ASC"
Me.OrderByOn = True


It appears to group the same words into groups. However, the entire list is
not sorted in ascending order. Any help would be appreciated.

Regards
L
 
G

Guest

MyRecordset should be the name of your record source (table or query).

Me.OrderBy = MyRecordSet![Occurrence]
You don't need the ASC that is the default. If you want descending, then
you would use DESC.

Lowrider72 said:
Ok I tried that and it gave me an error saying MyRecordSet not
defined...Also, there is no sace...Occurrence is the control source and ASC
is the sort order...

Klatuu said:
Try this:
Me.OrderBy = MyRecordSet![Occurrence ASC]
This assumes Occurrence ASC is a field in your recordset. By the way,
spaces in names is always a bad idea. Consider OccurrenceASC or
Occurrence_ASC

Lowrider72 said:
Hello All,

I have been pulling my hair out on a simple problem. Hoping someone here
has the anwer. I am trying to sort a field on a form by coding it's "on
open" property. The field is a combo box. Here is the code:

Me.OrderBy = "Occurrence ASC"
Me.OrderByOn = True


It appears to group the same words into groups. However, the entire list is
not sorted in ascending order. Any help would be appreciated.

Regards
L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top