Getting Debug Notice when "Cancel" Button pushed

M

magmike

I have a control on my form that causes a msgbox to appear before
continuing its action. When "Cancel" is selected, the user gets an
error with a Debug or End choice. I know I left something out - but
can't remember what that is! Here is my code:

Private Sub Command7_Click()
Dim stSQL As String
Dim stControl As String

stSQL = "UPDATE ProspectTable" & _
" SET SelectMe = TRUE" & _
" WHERE EXISTS " & _
"(SELECT *" & _
" FROM SelectionList" & _
" WHERE SelectionList.CompanyID = ProspectTable.ID"
& _
" AND SelectionList.CampID = " & Me.CampID & ")"
stControl = "Company"
Forms!ProspectForm!SelCampID = CampID
DoCmd.RunCommand acCmdRefresh

DoCmd.RunSQL stSQL

DoCmd.GoToControl stControl
'DoCmd.ApplyFilter , "SelectMe = True"
Forms!ProspectForm.RecordSource = "Prospects with SelectMe"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL Statement wording 2
Error 2109 - Debug?? 0

Top