Event procedure does not execute without break point?????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an event procedure on a command button.
The procedure does not execute unless I put a break point in the code.
It works when I step thru it, but if I remove the break point and click on
the button, nothing happens.
Any clues????
 
Private Sub SelectAllbtn_Click()
Dim strsql As String

strsql = "UPDATE Employees INNER JOIN TimeSheets ON Employees.EmployeeID
= TimeSheets.EmployeeID SET TimeSheets.RunComm = -1 " & _
"where weekending = #" & [WeekEnding] & "# and recruiterid = " &
[RecruiterID] & ";"

DBEngine(0)(0).Execute strsql, dbFailOnError

End Sub
 
Is the idea to filter the recordset? If so, how about:

On Error Goto ProcErr

strsql = "UPDATE Employees INNER JOIN TimeSheets ON _
Employees.EmployeeID = TimeSheets.EmployeeID SET _
TimeSheets.RunComm = -1 " & "where weekending = #" & _
[WeekEnding] & "# and recruiterid = " & [RecruiterID] & ";"

Me.RecordSource = strSql
Me.Requery

ProcExit:
Exit Sub

ProcErr:
msgbox "Error #" & Err.Number & ", " & Err.Description
Resume ProcExit

Venus said:
Private Sub SelectAllbtn_Click()
Dim strsql As String

strsql = "UPDATE Employees INNER JOIN TimeSheets ON Employees.EmployeeID
= TimeSheets.EmployeeID SET TimeSheets.RunComm = -1 " & _
"where weekending = #" & [WeekEnding] & "# and recruiterid = " &
[RecruiterID] & ";"

DBEngine(0)(0).Execute strsql, dbFailOnError

End Sub


BruceM said:
What is the procedure?
 
I need to update the employees table.

BruceM said:
Is the idea to filter the recordset? If so, how about:

On Error Goto ProcErr

strsql = "UPDATE Employees INNER JOIN TimeSheets ON _
Employees.EmployeeID = TimeSheets.EmployeeID SET _
TimeSheets.RunComm = -1 " & "where weekending = #" & _
[WeekEnding] & "# and recruiterid = " & [RecruiterID] & ";"

Me.RecordSource = strSql
Me.Requery

ProcExit:
Exit Sub

ProcErr:
msgbox "Error #" & Err.Number & ", " & Err.Description
Resume ProcExit

Venus said:
Private Sub SelectAllbtn_Click()
Dim strsql As String

strsql = "UPDATE Employees INNER JOIN TimeSheets ON Employees.EmployeeID
= TimeSheets.EmployeeID SET TimeSheets.RunComm = -1 " & _
"where weekending = #" & [WeekEnding] & "# and recruiterid = " &
[RecruiterID] & ";"

DBEngine(0)(0).Execute strsql, dbFailOnError

End Sub


BruceM said:
What is the procedure?

:

I have an event procedure on a command button.
The procedure does not execute unless I put a break point in the code.
It works when I step thru it, but if I remove the break point and click on
the button, nothing happens.
Any clues????
 
From your cryptic reply I gather you need to update all records that meet
certain criteria. I will further assume that the SQL statement works in an
update query, but not from a command button. Instead of DBEngine.Execute,
try:

Docmd.RunSQL strSql

You may need to requery if you need immediate results on the current record.

Venus said:
I need to update the employees table.

BruceM said:
Is the idea to filter the recordset? If so, how about:

On Error Goto ProcErr

strsql = "UPDATE Employees INNER JOIN TimeSheets ON _
Employees.EmployeeID = TimeSheets.EmployeeID SET _
TimeSheets.RunComm = -1 " & "where weekending = #" & _
[WeekEnding] & "# and recruiterid = " & [RecruiterID] & ";"

Me.RecordSource = strSql
Me.Requery

ProcExit:
Exit Sub

ProcErr:
msgbox "Error #" & Err.Number & ", " & Err.Description
Resume ProcExit

Venus said:
Private Sub SelectAllbtn_Click()
Dim strsql As String

strsql = "UPDATE Employees INNER JOIN TimeSheets ON Employees.EmployeeID
= TimeSheets.EmployeeID SET TimeSheets.RunComm = -1 " & _
"where weekending = #" & [WeekEnding] & "# and recruiterid = " &
[RecruiterID] & ";"

DBEngine(0)(0).Execute strsql, dbFailOnError

End Sub


:

What is the procedure?

:

I have an event procedure on a command button.
The procedure does not execute unless I put a break point in the code.
It works when I step thru it, but if I remove the break point and click on
the button, nothing happens.
Any clues????
 
It still doesn't work.
The DBEngine works too if I put a break-point in the code and step thru it.
Thats the confusing thing. If I step thru the code it executes, If I just
run it without putting any breaks points, nothing happens.

BruceM said:
From your cryptic reply I gather you need to update all records that meet
certain criteria. I will further assume that the SQL statement works in an
update query, but not from a command button. Instead of DBEngine.Execute,
try:

Docmd.RunSQL strSql

You may need to requery if you need immediate results on the current record.

Venus said:
I need to update the employees table.

BruceM said:
Is the idea to filter the recordset? If so, how about:

On Error Goto ProcErr

strsql = "UPDATE Employees INNER JOIN TimeSheets ON _
Employees.EmployeeID = TimeSheets.EmployeeID SET _
TimeSheets.RunComm = -1 " & "where weekending = #" & _
[WeekEnding] & "# and recruiterid = " & [RecruiterID] & ";"

Me.RecordSource = strSql
Me.Requery

ProcExit:
Exit Sub

ProcErr:
msgbox "Error #" & Err.Number & ", " & Err.Description
Resume ProcExit

:

Private Sub SelectAllbtn_Click()
Dim strsql As String

strsql = "UPDATE Employees INNER JOIN TimeSheets ON Employees.EmployeeID
= TimeSheets.EmployeeID SET TimeSheets.RunComm = -1 " & _
"where weekending = #" & [WeekEnding] & "# and recruiterid = " &
[RecruiterID] & ";"

DBEngine(0)(0).Execute strsql, dbFailOnError

End Sub


:

What is the procedure?

:

I have an event procedure on a command button.
The procedure does not execute unless I put a break point in the code.
It works when I step thru it, but if I remove the break point and click on
the button, nothing happens.
Any clues????
 
Back
Top