Hi,

My code is not deleting the selected record as I wanted to. I think there is something wrong with the line of code, DoCmd.RunSQL ("DELETE FROM UserRole WHERE WindowsUser = " & strDeleteUser)

Any advice will be greatly appreciated!


Private Sub cmdDeleteUser_Click()
Dim Check As Integer
Dim strDeleteUser As String

strDeleteUser = Me.txtFillWindowsUser.Value

Check = MsgBox("Are you sure that you want to delete this user?", vbYesNoCancel)
If Check = vbCancel Then
Cancel = True
ElseIf Check = vbYes Then
DoCmd.RunSQL ("DELETE FROM UserRole WHERE WindowsUser = " & strDeleteUser)
DoCmd.Requery
DoCmd.OpenForm "frmAdmin"
ElseIf Check = vbNo Then
No = True
End If

End Sub