Hi,
I'm trying to save,or not, to a table from a textbox via a msgbox but even if I click no it still saves whatever value is in the textbox to the table. Can anyone see where i'm going wrong:
Private Sub cmd2_Click()
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
CurrentDb.Execute "UPDATE tbltruststaff SET AFCCode = '" & Me!Txt2 & "' WHERE Code = '" & Me!Txt1 & "'"
' To save display a message.
strMsg = "Would you like to save this record."
intStyle = vbYesNo
strTitle = "Save"
MsgBox strMsg, intStyle, strTitle
Select Case intStyle
Case vbYes
'do nothing
Case vbNo
Me.Undo
End Select
Me.Txt1.DefaultValue = ""
Me.Txt2.DefaultValue = ""
End Sub
I'm trying to save,or not, to a table from a textbox via a msgbox but even if I click no it still saves whatever value is in the textbox to the table. Can anyone see where i'm going wrong:
Private Sub cmd2_Click()
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
CurrentDb.Execute "UPDATE tbltruststaff SET AFCCode = '" & Me!Txt2 & "' WHERE Code = '" & Me!Txt1 & "'"
' To save display a message.
strMsg = "Would you like to save this record."
intStyle = vbYesNo
strTitle = "Save"
MsgBox strMsg, intStyle, strTitle
Select Case intStyle
Case vbYes
'do nothing
Case vbNo
Me.Undo
End Select
Me.Txt1.DefaultValue = ""
Me.Txt2.DefaultValue = ""
End Sub