From: Phillip on
Hi,
I posted this earlier but it never appeared.
I have a continuous form that displays 4 fields from a table. The form also
has sort buttons which sorts the records in the form based on the sort
selected. My table also has a field called “sequence number”. Based on the
sort that is selected I would like to save the record sequence number for
each record based on the order that the records appear in the form. In
other words the record that appears first in the form would have a sequence
number of 1 stored for that record in the table, the second record would have
a sequence number of 2, etc.
Is this possible and if so can some help me with the code.
Thanks in advance,

From: Tom van Stiphout on
On Fri, 26 Mar 2010 10:39:01 -0700, Phillip
<Phillip(a)discussions.microsoft.com> wrote:

That is possible, even though I'm at a loss trying to understand why
you would want to do this. Yet here we go:
When the user clicks the Sort button, you first sort the data like you
are already doing, and then you additionally run some VBA code like
this:
dim l as long
if me.recordsetclone.recordcount > 0 then
with me.recordsetclone
.MoveFirst
l = 1
while not .eof
.edit
![sequence number] = l
.update
l = l + 1
.MoveNext
wend
end with
end if

-Tom.


>Hi,
>I posted this earlier but it never appeared.
>I have a continuous form that displays 4 fields from a table. The form also
>has sort buttons which sorts the records in the form based on the sort
>selected. My table also has a field called �sequence number�. Based on the
>sort that is selected I would like to save the record sequence number for
>each record based on the order that the records appear in the form. In
>other words the record that appears first in the form would have a sequence
>number of 1 stored for that record in the table, the second record would have
>a sequence number of 2, etc.
>Is this possible and if so can some help me with the code.
>Thanks in advance,
From: Phillip on
Hi Tom,
Thanks you that is just what I needed and it worked great.
Thanks again,


"Tom van Stiphout" wrote:

> On Fri, 26 Mar 2010 10:39:01 -0700, Phillip
> <Phillip(a)discussions.microsoft.com> wrote:
>
> That is possible, even though I'm at a loss trying to understand why
> you would want to do this. Yet here we go:
> When the user clicks the Sort button, you first sort the data like you
> are already doing, and then you additionally run some VBA code like
> this:
> dim l as long
> if me.recordsetclone.recordcount > 0 then
> with me.recordsetclone
> .MoveFirst
> l = 1
> while not .eof
> .edit
> ![sequence number] = l
> .update
> l = l + 1
> .MoveNext
> wend
> end with
> end if
>
> -Tom.
>
>
> >Hi,
> >I posted this earlier but it never appeared.
> >I have a continuous form that displays 4 fields from a table. The form also
> >has sort buttons which sorts the records in the form based on the sort
> >selected. My table also has a field called “sequence number”. Based on the
> >sort that is selected I would like to save the record sequence number for
> >each record based on the order that the records appear in the form. In
> >other words the record that appears first in the form would have a sequence
> >number of 1 stored for that record in the table, the second record would have
> >a sequence number of 2, etc.
> >Is this possible and if so can some help me with the code.
> >Thanks in advance,
> .
>