Hello,
I was wondering if someone could assist me in creating some code that when I click on a Button on the form the it will utilize an Event Procedure to where it creates a new record but copying over data of like 4 fields from the previous record automatically.
Any help is appreciated, thank you!
I was wondering if someone could assist me in creating some code that when I click on a Button on the form the it will utilize an Event Procedure to where it creates a new record but copying over data of like 4 fields from the previous record automatically.
Any help is appreciated, thank you!
Code:
Private Sub Tech_Dup_Click()
DoCmd.GoToRecord acDataForm, "Search_Main_Datasheet", acNewRec
Forms!Search_Main_Datasheet!ID = 1
Dim db As Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Main")
With rst
.AddNew
![Number] = Me![Number]
![First] = Me![First]
![Last] = Me![Last]
![Supervisor] = Me![Supervisor]
.Update
End With
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub