Goto Form
Right Click on "History" Button
Select Properties
Select Events
Select "On Click" Event. Click on the dots "..."
Select "Code Builder"
Paste the code in the Click Event.
Click Save Button. Click Exit VBA editor, and you should be good.
Code:
Dim sql As String
On Error GoTo ErrHandler:
sql = "INSERT INTO [History] (AssetID, AssetCategoryID, EmployeeID, DateBorrowed, DateReturned) " _
& "VALUES (" & Me.AssetID.Value & ", " & Me.AssetCategoryID.Value & ", " & Me.EmployeeID.Value & ", #" & TimeValue(Me.DateBorrowed) & "#, #" & DateValue(DateReturned) & "#)"
DoCmd.RunSQL (sql)
MsgBox "History Added!"
Exit Sub
ErrHandler:
MsgBox "Missing or incorrect information. Check to ensure all fields have proper data and try again."
Exit Sub