Copy Last Record
Use DMAX and DLOOKUP to Copy the Last Record Entered
If you are entering a bunch of similar records, this
tip will save you time. With one button you can copy the last
record entered and any fields you want, while leaving some other fields
blank for new data entry. For example, we will copy products and leave
the serial number field blank. We will use the DMAX and
DLOOKUP functions to accomplish this.
This tutorial explains how to do it...
Here's the source code, if you want to copy and paste it:
Dim ID As Long
ID = DMax("ProductID", "ProductT")
DoCmd.GoToRecord , , acNewRec
ProductName = DLookup("ProductName", "ProductT", "ProductID=" & ID)
SalePrice = DLookup("SalePrice", "ProductT", "ProductID=" & ID)
DateEntered = DLookup("DateEntered", "ProductT", "ProductID=" & ID)
Learn More About DLOOKUP...
I teach DLOOKUP my
Access Expert Level
Click this link to watch my FREE 2-hour
long Access Beginner Level 1
By Richard Rost
Click here to sign up for more FREE tips