Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking Back at Previous Record 1

Status
Not open for further replies.

BAWC01

Technical User
Nov 23, 2005
79
CH
Hi

I have a simple form, which just adds to a table with the following data.

Code:
Date        New         Previous
01/05/06    30            20

What I want to do is the following:

When the user enters a new entry the PREVIOUS field is automatically populated with whatever was entered last.

So the user enters the DATA and the NEW value and the PREVIOUS is automatically populated.

How can I do this

Thanks

Phil

 
I created an Data input form (Data Entry set to yes). I then created an unbound textbox called PreData. The form shows Date and NewData field from a table. I then placed the following on the OnCurrent event of the form:

Dim RS As DAO.Recordset
Dim DB As DAO.Database
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("YourTableName", dbOpenDynaset)
RS.MoveLast
Me![PreData].Value = RS![NewData]
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
 
Excellent

Thank you, has helped and I have solved the problem thanks to your post

Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top