Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Answered

VBA help

Posted on by 1,615

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

  • Verified answer
    Ram Peru Profile Picture
    Ram Peru 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.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,835 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,526 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans