Running stored procedure from module in .adp file

  • OK, here 'tis in its most economical form...(and it works!)

    Function MakeTblSproc(FileTypeText As String)

    On Error GoTo FreeWilly

        Dim MyCmd As ADODB.Command

        Dim rs As ADODB.Recordset

        Set MyCmd = New ADODB.Command

         

       With MyCmd

             .ActiveConnection = CurrentProject.Connection

             .CommandText = FileTypeText

             .CommandType = adCmdStoredProc

             .Parameters.Append MyCmd.CreateParameter("EndDate", adVarChar, adParamInput, 100, EndDate)

             .Parameters.Append MyCmd.CreateParameter("Account1", adVarChar, adParamInput, 100, Account1)

       End With

     

        Set rs = MyCmd.Execute()

        Set MyCmd = Nothing

          

     Exit Function

    FreeWilly:

    MsgBox Err.Description

    Exit Function

               

    End Function

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply