Hello,
I have been trying to get this code to work for me and I just can't seem to get it to work right. It appears that the code is just skipping over my first "If" clause and going straight to the sql. Any help would be greatly appreciated.
Thanks,
PROXI
I have been trying to get this code to work for me and I just can't seem to get it to work right. It appears that the code is just skipping over my first "If" clause and going straight to the sql. Any help would be greatly appreciated.
Code:
Private Sub Command10_Click()
Dim strSQL As String
Dim resp As Long
Dim ctl As Control
If Nz(Me.PPA_NBR, "") & "" <> "" Then
MsgBox "Please input an administrator number", vbOKOnly, "Input Error"
GoTo Command10_Click_Exit
Else
strSQL = "INSERT INTO PPA_Watchlist (PPA_NBR, PPA_NAME, Region, Comment, Watchlist)" _
& "Values ('" & PPA_NBR & "','" & PPANAME & "','" & Region & "','" & Comment & "','Yes');"
DoCmd.RunSQL strSQL
resp = MsgBox("Would you like to input another administrator?", vbYesNoCancel, "Are you finished?")
Select Case resp
Case vbYes
Me.PPA_NBR = ""
Me.PPANAME = ""
Me.Region = ""
Me.Comment = ""
Me.PPA_NBR.SetFocus
Case vbNo
DoCmd.Close
Case vbCancel
Cancel = True
strSQL = "DELETE * FROM " _
& "PPA_Watchlist WHERE PPA_NBR = '" & PPA_NBR & "';"
DoCmd.RunSQL strSQL
End Select
End If
Command10_Click_Exit:
Exit Sub
End Sub
Thanks,
PROXI