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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks so much for your time and effort but it works now.
The problem was that the previous item was not losing the focus.
Its wierd because when I click on the command button, it should
automatically set the focus to it. But when I did it explicitly by using
"set focus" in a macro, it started working.
Strange but it works!!
Thanks again.

"BruceM" wrote:

> In what way does it now work? Is there an error message? In the line:
> "where weekending = #" & [WeekEnding] & "# and recruiterid = " &
> [RecruiterID] & ";"
> how does weekending differ from [WeekEnding]? Same for RecruiterID.
> Are you trying to change many records or just the current one? Are you
> trying to accomplish through this code what could also be accomplished
> through an update query? It's fine if you are, but there are certain syntax
> rules you need to follow. If you can make this work through a query, post
> the query's SQL.
> I will need you to answer the questions in this post if I am to put any more
> time into this. My guesses about what you need to do have been wrong so far.
> If it is important to use DBEngine.Execute then you will need to start a new
> thread. I am not familiar with that command. However, be advised that
> whoever answers will probably ask as I have what you need to accomplish.
> Saying that you need to update the table pretty much describes any data entry
> or modification.
>
>
> "Venus" wrote:
>
> > 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" wrote:
> >
> > > 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" wrote:
> > >
> > > > I need to update the employees table.
> > > >
> > > > "BruceM" wrote:
> > > >
> > > > > 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" wrote:
> > > > >
> > > > > > 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" wrote:
> > > > > >
> > > > > > > What is the procedure?
> > > > > > >
> > > > > > > "Venus" wrote:
> > > > > > >
> > > > > > > > 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????
.



Relevant Pages

  • Re: Update Query Confirmation
    ... I am assuming that it is because the SQL statement is ... not sure how to refer to it in the execute statement. ... > Precede your DoCmd.RunSQL command with this code step to turn them ... >> Because it is an update query it asks for confirmation every time it ...
    (microsoft.public.access.queries)
  • RE: Event procedure does not execute without break point?????
    ... how does weekending differ from? ... I am not familiar with that command. ... whoever answers will probably ask as I have what you need to accomplish. ... >> update query, but not from a command button. ...
    (microsoft.public.access.forms)
  • Re: Updating Multiple records based on values
    ... The SQL statement for the update query might ... digit code is trimmed and then run a special SQL update to set the ... State field correctly, but I haven't been able to get it working. ...
    (microsoft.public.access.modulesdaovba)
  • Re: update queries and forms
    ... > should enter an incorrect account number. ... > and makes your validation much easier. ... > OK - so what we want the command button to do is to run the update query. ...
    (microsoft.public.access.tablesdbdesign)
  • RE: Running an Update query before closing a form
    ... place the following command: ... update query and couldn t save all records because of various violations ... the update query before closing? ... I have not written an SQL in codes. ...
    (microsoft.public.access.formscoding)