Applecore Pages on Microsoft Access

Using the values for the previous record as the default values for a new record

If you wish to speed up the data entry in your application, you can, where it is appropriate, automatically create a new record with data from the previous record as the default. Below is some sample code to do this:

Private Sub Form_Current()
    If Me.NewRecord = True Then
        Dim rsClone As Recordset
        Set rsClone = Me.RecordsetClone
        rsClone.MoveLast
        Me!FirstName = rsClone!FirstName
        Set rsClone = Nothing
    End If
End Sub

As ever in Access, there are many variations on this theme.

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 14:54:05