I'm hoping someone can tell me if this is the right or best way to do
this: (and do I want or need the Set cmd = Nothing, cnn.close, Set cnn
= Nothing???)
I'm setting cnn using the CurrentProject. Connection I don't see it
referenced to later...
I have dozens of functions cunstructed like this - are they all bogus?
Function myFunctionName( )
On Err GoTo myErr
Dim cnn As ADODB.Connectio n
Dim cmd As ADODB.Command
Dim myLinkID as Long
myLink ID = someUniqueID
Set cnn = CurrentProject. Connection
Set cmd = New ADODB.Command
Set cmd.ActiveConne ction = CurrentProject. Connection
cmd.CommandText = "mySPName"
cmd.CommandType = adCmdStoredProc
cmd.Execute , Parameters:=Arr ay(myLinkID),
Options:=adExec uteNoRecords
myExit:
On Error Resume Next
Set cmd = Nothing
cnn.Close
Set cnn = Nothing
Exit Sub
myErr:
MsgBox Err.Number & " " & Err.Description
Resume myExit
End Sub
this: (and do I want or need the Set cmd = Nothing, cnn.close, Set cnn
= Nothing???)
I'm setting cnn using the CurrentProject. Connection I don't see it
referenced to later...
I have dozens of functions cunstructed like this - are they all bogus?
Function myFunctionName( )
On Err GoTo myErr
Dim cnn As ADODB.Connectio n
Dim cmd As ADODB.Command
Dim myLinkID as Long
myLink ID = someUniqueID
Set cnn = CurrentProject. Connection
Set cmd = New ADODB.Command
Set cmd.ActiveConne ction = CurrentProject. Connection
cmd.CommandText = "mySPName"
cmd.CommandType = adCmdStoredProc
cmd.Execute , Parameters:=Arr ay(myLinkID),
Options:=adExec uteNoRecords
myExit:
On Error Resume Next
Set cmd = Nothing
cnn.Close
Set cnn = Nothing
Exit Sub
myErr:
MsgBox Err.Number & " " & Err.Description
Resume myExit
End Sub
Comment