web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

VBA help

(0) ShareShare
ReportReport
Posted on by 1,639

Hi there,

I would like to call a stored proc from VBA.  I would need to pass it a parameter.

What code would i use?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ram Peru Profile Picture
    2,830 on at

    Hello Jo Wykerd,

    You can use the below code to call Stored procedure from VBA code.

    If your SQL stored procedure returns Select statement, you can use the below code.

    Dim SQLStr as String

    SQLStr = “EXEC ProcedureName” & SParm (paramater1) & "," & SParm (Parameter1) & "," & DParm (Parameter3)

    serr1 = SqlFetch1 (c7, SQLStr, bbufferName, LenB (bbufferName))

    Call SqlFree (c7)

    If your SQL stored procedure does not return any Select statement, you can use the below code.

    Dim SQLStr as String

    SQLStr = “EXEC ProcedureName” & SParm (paramater1) & "," & SParm (Parameter1) & "," & DParm (Parameter3)

    Call Sql (c7, SQLStr)

    Call SqlFree (c7)

    Hope this explains.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans