Carrying Values From Record to record

H

HuskerJeff

I have a number of times that I want to look at the previous record in the
data base to get a value for this record. For example, if I am putting in a
series of entries with the same date, I would like to have the entry form
keep the last date I entered until I change it again. Do I have to build a
separate table just to hold that date and link to that? How can I reference
data from the immediately previous record in a table from the current form?
Easy to do in VB for Excel, but how about access?
 
J

Jeanette Cunningham

Hi,
One easy way is to set the default value of the textbox for the date.
The first time the form opens, users must enter the date.
On the after update event for the textbox for the date:

Private Sub txtTheDate_AfterUpdate()
If Not IsNull(Me.txtTheDate) Then
me.txtTheDate.DefaultValue ="#" & Me.txtTheDate & "#"
End If
End Sub

Each time users go to a new record the previous value for date will appear
in txtTheDate.
When the form is closed, the default value is lost.

Jeanette Cunningham
 

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