Save record sequence number from form

P

Phillip

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,
 
T

Tom van Stiphout

On Fri, 26 Mar 2010 10:39:01 -0700, Phillip

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.
 
P

Phillip

Hi Tom,
Thanks you that is just what I needed and it worked great.
Thanks again,


Tom van Stiphout said:
On Fri, 26 Mar 2010 10:39:01 -0700, Phillip

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,
.
 

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