Ensuring underlaying table is sorted immediately

R

rsosabusiness

User enters transactions collected from various sources. Often there
are several transactions for the same person. When a batch of
transactions is completed, the user may find that the batch does not
settle. Usually, the user can trace the error to a person. The form has
a combo box where the persons' names are collected from the underlaying
table and can find the first occurrence of that person by selecting the
name there. But because the records in the table are stored in the
order they were entered and not in the persons' names (main key),
locating each record for a given person can be time consuming. The most
direct solution is to ensure that the table is ordered immediately by
its main key. Can that be done? If not, is there a methog by which we
can locate all records for the same person sequentially?
 
N

Nikos Yannacopoulos

Tables are just "buckets" that you throw data in, with no guaranteed
order maintained. Make a simple select query on the table and sort as
required, then base the form on the query instead of the table itself,
and the problem is solved.

Alternatively, use the combo box to filter the records in the form, so
you only get those for the chosen user anyway (the wizard that kicks in
when adding a combo will do most of the hard work for you).

HTH,
Nikos
 
K

Klatuu

Nikos second suggestion is the prefered way to do this. Use the combo's
After Update event.

Me.Filter = "[Person] = '" Me.cboPerson & "'"
Me.FilterOn = True

Then when you want to see all the records again, have a command button to
"Show All" and use it's click event:

Me.FilterOn = False
 
R

rsosabusiness

Thank you friends!
I like the filter option, more by instinct than knowledge, since my
skills are limited. I will give it a try.
Have a wonderful day!
Robert
 
R

rsosabusiness

Thank you friends!
I like the filter option, more by instinct than knowledge, since my
skills are limited. I will give it a try.
Have a wonderful day!
Robert
 
R

rsosabusiness

Klatuu said:
Nikos second suggestion is the prefered way to do this. Use the combo's
After Update event.

Me.Filter = "[Person] = '" Me.cboPerson & "'"
Me.FilterOn = True

Then when you want to see all the records again, have a command button to
"Show All" and use it's click event:

Me.FilterOn = False
Klatuu,
Your code works. Thanks for providing it. An unexpected benefit is that
after filetering for a person and turning off the filter, all records
appear in person sequnce.
Once again, thank you and have a wonderful day.
 

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