value in new record based on previous value

G

gator

when a new record is started, how to I grab the value of a field in the
previous record and put it in the new field?
 
D

Dorian

Depends what you mean by 'previous record'. Records have no inherent sequence
in a relational database. Do you mean the last record you looked at?
If so, you will need to save the data somewhere so you can retrieve it after
you get the next record. You could save it in the AfterUpdate event in a
hidden unbound control then retrieve it in the Current event.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
M

Mike Painter

Dorian said:
Depends what you mean by 'previous record'. Records have no inherent
sequence in a relational database. Do you mean the last record you
looked at?
If so, you will need to save the data somewhere so you can retrieve
it after you get the next record. You could save it in the
AfterUpdate event in a hidden unbound control then retrieve it in the
Current event. -- Dorian
"Give someone a fish and they eat for a day; teach someone to fish
and they eat for a lifetime".

I've been wanting MSFT to exposr the previous record (in the form) since
Access 2.
It's ther as pressing Ctrl " shows us.
It should at least be available as a default in a form, but
".previousrecord.MyField would be better.

With Rst
some code
.movenext
.MyField = .previous record.Myfield + 1
more code
End with.

I'm sure there is a slower way to perform that particular operation but the
idea should be clear.

This lack was the second or third thing I missed when moving frm Revelation,
a Pick based system to Access.
 

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