Skip to main content

Notifications

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

  • Verified answer
    Ram Peru Profile Picture
    2,830 on at
    RE: VBA help

    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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans