Hi guys this is my first piece of VBA code ever. Its meant to create new record in "Hours" table when clicking on "NewPayButton", and in the field Beginning its supposed to use today's date.
Needles to say it fails to do its job. Debugger points to the third line[Private Sub NewPayButton_Click()], with pop up saying "Object required".
I'm not sure what object am I missing?
Option Compare Database
Private Sub NewPayButton_Click()
Dim PayrollDb As DAO.Database
Dim WHours As DAO.Recordset
Dim Today As Date
Set PayrollDb = CurrentDb
Set WHours = PayrollDb.OpenRecordset("Hours")
Set Today = Now
WHours.AddNew
WHours("Begining").Value = Today
WHours.Update
End Sub
I've attached the database that uses this code.
Thanks