Hello there, I am trying to update a table and adding new information when I hit a button. Now eventually this will record when a person enters and leaves the system, but I am testing this out on basic information first.
The code I used is this:
Code:
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
'Dim Commands for Fields/Boxes
Dim LastName As String
Dim FirstName As String
Dim Number As Integer
Dim Address As String
GoSub AdditionSample
AdditionSample:
'Updating the Sample table using this
Set rst = db.OpenRecordset("tblSample", dbOpenDynaset)
With rst
.AddNew
!LastName = Form!frmSample!LastName
!FirstName = Form!frmSample!FirstName
!Number = Form!frmSample!PhoneNumber
!Address = DLookup("[Address]", "[tblEmployeeInformation]", "[EmployeeID] = 1")
.Update
.Close
End With
Return
Exit Sub
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
It keeps giving me an error on the Private Sub section. What am I doing wrong?