Access 2003 Form Crashing!

M

Midland

I have been creating and upgrading a form for data input into a Access 2003
data table. This has been an ongoing project I've been tinkering with for
several weeks, but, suddenly, the link has gone random on me. That is,
instead of referencing the records in order (1, 2, 3, etc, through row 8340)
the form is looking at them randomly. That is, record 1 on the form is now
referencing record 1891 on the table, record 2 on the form is referencing
record 4924 on the table. What could cause something like this?
 
D

Dirk Goldgar

Midland said:
I have been creating and upgrading a form for data input into a Access 2003
data table. This has been an ongoing project I've been tinkering with for
several weeks, but, suddenly, the link has gone random on me. That is,
instead of referencing the records in order (1, 2, 3, etc, through row
8340)
the form is looking at them randomly. That is, record 1 on the form is now
referencing record 1891 on the table, record 2 on the form is referencing
record 4924 on the table. What could cause something like this?


Begging your pardon, but this is not "crashing". It's just a change in the
sort order; at least, that's what it sounds like.

In the absence of any specified sort order, Access generally returns records
in the sequence that is most convenient for it. Normally, if a form is
based directly on a single table, that's the primary-key sequence of the
table. Have you recently applied a sort order to the form's RecordSource
query? Check the form's Order By property.

Is the form's RecordSource a query that involves more than one table? If
the query doesn't specify a sort sequence, then the order of the records
will depend on the execution plan that Access has come up with for the
query.

In general, though, Access makes no promises to return records in a
particular order unless you explicitly specify a sort sequence. If you want
your form always to return records sorted in order on a specific field or
fields, set the form's RecordSource to a query that applies the sort you
want.
 
D

Douglas J. Steele

Are you using the table as the RecordSource for the form, or are you using a
query?

If the table, you should never make any assumptions about the order in which
records are displayed. The only way to guarantee a specific order is to use
a query with an appropriate ORDER BY clause.
 
M

Midland

Thanks, I discerned from your answers that I accidentally tapped a "sort"
command while editing a control in my form. Another of those little error
possibilities they don't warn us about in Access beginners courses.
 
D

Douglas J. Steele

Not necessarily.

They should have taught you at your course that you cannot assume anything
about the order in which data will be returned from tables. Compacting the
database may completely reorder the rows. You should always use queries if
the order of the data is important to you.
 

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