Waiting for passthrough query

  • Thread starter Thread starter Marcus
  • Start date Start date
M

Marcus

I have some ADO statements in my code (INSERT, UPDATE, DELETE) used in a
passthorugh fashion, like
 
hi Marcus,
I would like to force Access to wait for command execution before
stepping into the next line of code... how?
It does not wait? Imho this call should by synchronized. You may try:

Option Compare Database
Option Explicit

Private WithEvents m_Connection As ADODB.Connection

Private Sub m_Connection_ExecuteComplete(..)
MsgBox "Completed..."
End Sub


mfG
--> stefan <--
 
Stefan Hoffmann said:
hi Marcus,

It does not wait? Imho this call should by synchronized. You may try:

Option Compare Database
Option Explicit

Private WithEvents m_Connection As ADODB.Connection

Private Sub m_Connection_ExecuteComplete(..)
MsgBox "Completed..."
End Sub

Stefan should I set the coe above in the form's code? That sub will be
invoked by ADO? Only when Execute statment is completed?
I was afraid passthrough statements were execute in asynchronous mode...
 
hi Marcus,
Stefan should I set the coe above in the form's code? That sub will be
invoked by ADO?
Yes and yes.

It will be called by your Connection object. Place it in that module
where you create your Connection:

Private WithEvents myCN As ADODB.Connection

The Private keyword may be replaced with Public.
Only when Execute statment is completed? Yes.

I was afraid passthrough statements were execute in asynchronous mode...
A passthrough query is a query executed by DAO, not by ADO. Your mixing
things up. Passthrough queries are executed synchronous.


mfG
--> stefan <--
 
A passthrough query is a query executed by DAO, not by ADO. Your mixing
things up. Passthrough queries are executed synchronous.

Ouch! I'm using ADO..... do you know what happens when issueing an
cn.execute command if it works in synchronous mode?

Thanks
 
hi Marcus,
Ouch! I'm using ADO..... do you know what happens when issueing an
cn.execute command if it works in synchronous mode?
As long as you don't set any option for the Options parameter of the
Execute method is should be executed synchronously.

--
Function Execute(CommandText As String, [RecordsAffected], [Options As
Long = -1]) As Recordset
Element from ADODB.Connection
--

btw, why do you think that it is running async?

mfG
--> stefan <--
 
Stefan Hoffmann said:
hi Marcus,
Ouch! I'm using ADO..... do you know what happens when issueing an
cn.execute command if it works in synchronous mode?
As long as you don't set any option for the Options parameter of the
Execute method is should be executed synchronously.

--
Function Execute(CommandText As String, [RecordsAffected], [Options As
Long = -1]) As Recordset
Element from ADODB.Connection
--

btw, why do you think that it is running async?

mfG
--> stefan <--

I'm getting strange results.

In a subform's Afterupdate event I need to do some updates/deletes/inserts
in other tables and sometimes when user input is very fast, some updates
don't occur, so I thought that in particularly busy server environment
(queries are sent to a SQl server) and a very fast user that can exit the
form just pressing twice ESC key, that could happen, especially if the
"execute" statements are issued async.
 
Back
Top