rst.AddNew

  • Thread starter Ana via AccessMonster.com
  • Start date
A

Ana via AccessMonster.com

Hello!
I'm now trying to insert new record in an existing table with command rst.
AddNew. But, my problem is that when he inserts record, he puts it on the end
of table. First column of table is AutoNumber, second is Date. I want him to
put new record in appropriate place, acceding by Date.
Thanks in advance!
Ana
 
K

Keith Wilby

Ana via AccessMonster.com said:
Hello!
I'm now trying to insert new record in an existing table with command rst.
AddNew. But, my problem is that when he inserts record, he puts it on the
end
of table. First column of table is AutoNumber, second is Date. I want him
to
put new record in appropriate place, acceding by Date.
Thanks in advance!
Ana

The order in which records are stored in a table is of no consequence. It
sounds like you need to sort your records by date using a query and
presenting them to the user in a form, that is to say, don't use the tables
to present or manipulate the data.

Keith.
www.keithwilby.co.uk
 
A

abolen via AccessMonster.com

The order in which records are stored in a table is of no consequence. It
sounds like you need to sort your records by date using a query and
presenting them to the user in a form, that is to say, don't use the tables
to present or manipulate the data.

Actually, I realy need it to be sort in table becouse I'm doing some
calculations on a group of records, where each one is depending on the the
previous one - it is recursion. So, query or form doesn't help me much.
 
A

Allen Browne

Ana, I don't think you understood what Keith was saying.

In database theory, a table is just a bucket you throw records into. It has
no order. If you want them in a particular order, you must provide a way to
do that.

It sounds like you have an autonumber (primary key) and a date. You want the
records sorted by date, and if there are 2 records for the same date you
would then use the autonumber to determine which comes first. Is that the
idea?

If so, you do that by creating a query. Use the Sort row to order them the
way you want.

Hopefully you are not storing values that depend on the previous row in the
table. Another important rule of table design is to not store dependent
values. It is a bit of an art to get these concepts applied to your data.
Here's some basic concepts on calculated fields:
http://allenbrowne.com/casu-14.html

And here's an example of how to design a query that calculates the
difference between the current meter reading and the previous reading:
http://allenbrowne.com/subquery-01.html#AnotherRecord
 
Top