Problems when executing stored procedure SQL2000 - MSACCESS97

R

rvdw

Hi All,

I've a serious problem with executing stored procedures (SQL2000) from
an Access db (version 97). After executing a stored procedure ,
msaccess hangs. The whole call to the procedure is running fine, but
immediatly after this msaccess hangs, when the focus goes back to the
calling form ?
Has anyone any idea what i can test or look at.

Thanks a lot !!!!!!



CODE*************


Function DownloadData() 'This is the function executed when clicking
on a btn on form
Dim RetVal

RetVal = Execute_Procedure("sp_DownloadData", "", False)
MsgBox "All data has been downloaded "
'UNTIL EVERYTHING IS WORKING FINE BUT WHEN GOING OUT THIS FUNTION
THE ACCESS APPLICATION START USING 100% CPU AND HANGS

End Function




Public Function Execute_Procedure(iProcedure As String, iArgs As
String, iIndicator As Boolean) As Boolean


Dim t1, t2
t1 = Timer

DoCmd.Echo False, "Executing procedure " & iProcedure & " " &
iArgs


Dim oCn As ADODB.Connection
Set oCn = New ADODB.Connection

oCn.ConnectionString = gCn
oCn.Open
oCn.CommandTimeout = 0

Dim oCmd As ADODB.Command
Set oCmd = New ADODB.Command

oCmd.CommandTimeout = 0
oCmd.CommandType = adCmdStoredProc

oCmd.CommandText = iProcedure & iArgs

oCmd.ActiveConnection = oCn

oCmd.Execute , , adExecuteNoRecords

oCn.Close

t2 = Timer

DoCmd.Echo False, iProcedure & " executed in " & CInt((t2 - t1)) &
" seconds"

Set oCmd = Nothing
Set oCn = Nothing

Execute_Procedure = True

End Function
 

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

Top