Updating first record of table

G

Guest

I have a table containing a variable number of records and wish to update a
particular field in the first record of the table - but only in the first
record. This would be easy if one of the fields in the first record
contained a unique and predictable value which could be used as a criterion
in an update query but there is no way of knowing which records the table
will contain, at any given time, and therefore no way of knowing what values
the fields will contain. How can the required operation be performed?
 
G

Guest

If this is a relational database, the order of the records in a table is
supposed to have no meaning. You should have a column that is used for
sequencing, it could be a key or maybe a date. Otherwise, you need to rethink
your design as the concept of 'first' as a physical order in a table is
meaningless. The order of records in a table is not guaranteed and is totally
unpredictable.

Dorian
 
G

Guest

The 'first' record is the first record to be entered into the table. (It is
always initially empty.) Further records may, or may not, be added depending
on what is entered on the form to which the table is bound.

It is subsequently necessary to identify the first record added but, as I
explained, if none of the fields has any uniquely distinguishing features
then it is impossible to locate the 'first' record for the purpose of running
an update query on that record alone.

I have taken the advice of the earlier responding MVP and added a field to
all the records which can be added to the table concerned. (They are
obtained from a number of other tables, which have therefore all had to be
modified.) This additional field then has a sequential number entered before
it is added to the main table, enabling the required 'first' record to be
exclusively updated by the subsequent update query. It all works fine but it
required the redesign of around a dozen tables which was a level of upheaval
that I was hoping to avoid.
 

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