Good Morning
I was hoping someone could possible assist.
I currently have some code. That with a current record on the form. The user can append to a different table.
Once user click a message box come up asking Are you sure you would like to "append" the following record, if user says yes. Brilliant it "appends", if user says No, it cancel the whole "append"
Curerntly miine works when user says Yes, but upon clicking No. It still appends the record.
I hoped someone could asssit.
I was hoping someone could possible assist.
I currently have some code. That with a current record on the form. The user can append to a different table.
Once user click a message box come up asking Are you sure you would like to "append" the following record, if user says yes. Brilliant it "appends", if user says No, it cancel the whole "append"
Curerntly miine works when user says Yes, but upon clicking No. It still appends the record.
I hoped someone could asssit.
Code:
Private Sub Command107_Click()
On Error GoTo Err_Handler
Dim db As DAO.Database
Set db = CurrentDb()
Dim strSQL As String
Dim iAnswer As Integer
iAnswer = MsgBox("Are you sure you would like to copy the record for " _
& Me.[First Name] & " " & Me.Surname & " " _
& "to the HR Table?" _
, vbCrLf & vbYesNoCancel)
If vbYes Then
DoCmd.SetWarnings False
strSQL = "INSERT INTO TblCandidates (1,2,1,)"
strSQL = strSQL & "SELECT 1,2,1 FROM tblPersonnelInfo "
strSQL = strSQL & "WHERE ID = Forms!form1!id ;"
DoCmd.RunSQL strSQL
If vbNo Then GoTo Exit_Command107_Click:
'User doesn't want to append data
End If
Exit_Command107_Click:
Exit Sub
Err_Handler:
MsgBox "Error: " & Err.Number & " - " & Err.Description
Resume Exit_Command107_Click