Return Message to Access from SQL SP

  • I have a form where a user enters a parameter. My button then takes that parameter and calls a SQL Stored Procedure. Everything is working, except I cannot get my return message to display in my text box on the form.

    Button Code:

    Private Sub Command28_Click()

    Dim strSQL As String

    Dim returnMessage As String

    strSQL = "EXEC SP_PPM_FTE_Append '" & Forms![frmMain]![WhatFiscalYear] & "' , returnMessage"

    CurrentDb.QueryDefs("EXECSP_PPM_FTE_Append").SQL = strSQL

    DoCmd.OpenQuery "EXECSP_PPM_FTE_Append", acViewNormal, acEdit

    boxMessage = returnMessage

    End Sub

  • Okay, it looks like you have ReturnMessage as an output parameter in the stored procedure. You need to specify that in the call to the stored procedure. Something like this:

    "EXEC SP_PPM_FTE_Append '" & Forms![frmMain]![WhatFiscalYear] & "' , returnMessage OUTPUT"

Viewing 2 posts - 1 through 1 (of 1 total)

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