Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

How VBA variable pass a value to a Report calculated field ?

(0) ShareShare
ReportReport
Posted on by 3,795

I am still a newbie of VBA. I have a modified report, under the Report Writer, I created a calculated field named as curDocAmt and then in VBA (Microsoft Visual Basic) I have some scripts and it will then assign a computed value to pass to the calculated field, curDocAmt.

But the problem is my VBA script just cannot do it job. Please check below and advise me. Thank you so much.

curDocAmt.value = varNewAmt


*This post is locked for comments

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,957 Most Valuable Professional on at
    Re: Re: Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    I have the advantage that I am also working on the issue from a support case and have the package file.

    But I made that suggestion before looking at the package file. :-)

    David

     

    David Musgrave [MSFT]
    Escalation Engineer - Microsoft Dynamics GP
    Microsoft Dynamics Support - Asia Pacific

    Microsoft Dynamics (formerly Microsoft Business Solutions)
    http://www.microsoft.com/Dynamics

    mailto:David dot Musgrave at microsoft dot com
    http://blogs.msdn.com/DevelopingForDynamicsGP

    Any views contained within are my personal views and not necessarily Microsoft policy.
    This posting is provided "AS IS" with no warranties, and confers no rights. 

  • L Vail Profile Picture
    L Vail 65,271 on at
    Re: Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    Ahh David,

    Did we have the machine turnded on ; . .

    Thanks for your excellent help!;

     

    Kind regards,

     Lesllie

  • William Kow Profile Picture
    William Kow 3,795 on at
    Re: Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    Many thanks for your reply. I always compile to VBA for validity before I run the report with VBA script. the error related to report field is not recognized by VBA is mainly due to my missing step to add it into VBA -- mentioned by David.

    Again, I would like to thank to all the people who contribute in this community.

     

  • William Kow Profile Picture
    William Kow 3,795 on at
    Re: Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    Thank you so much David.

    I do not even aware that the report calculated "field" is also need to "add" into the VBA. All the while I thought just only need to add the "Modified Report" into the VBA -- so i have ignored the report objects/fields are also need to add into VBA -- so that it can be recognized in VBA.

    Thanks.

     

  • L Vail Profile Picture
    L Vail 65,271 on at
    Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    Does the Result Type of the calculated field match the data type you are sending it? Does any value print? Has security been granted to the modified report?

    Just a couple of thoughts.

    Kind regards,

    Leslie

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,957 Most Valuable Professional on at
    Re: Re: Re: How VBA variable pass a value to a Report calculated field ?

    You need to add the report AND the field to Visual Basic.

    Highlight the field in the report layout mode and select Tools >> Customize >> Add Field to Visual Basic.

    David

    David Musgrave [MSFT]
    Escalation Engineer - Microsoft Dynamics GP
    Microsoft Dynamics Support - Asia Pacific

    Microsoft Dynamics (formerly Microsoft Business Solutions)
    http://www.microsoft.com/Dynamics

    mailto:David dot Musgrave at microsoft dot com
    http://blogs.msdn.com/DevelopingForDynamicsGP

    Any views contained within are my personal views and not necessarily Microsoft policy.
    This posting is provided "AS IS" with no warranties, and confers no rights. 

  • William Kow Profile Picture
    William Kow 3,795 on at
    Re: Re: How VBA variable pass a value to a Report calculated field ?

    Many thing for your reply.

    Yes, the field name in the VBA is under Report_BeforeBody event. And I put the report calculated field in the report body. What is other possibility for the VBA cannot recognize the report calculated field.

    Thank you so much.

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,267 on at
    Re: How VBA variable pass a value to a Report calculated field ?

    VBA code will not work if your code is not in proper header i.e. in Start , or  BeforAH,BeforeBody. it depend where is your calculated field in Report.

    I face this type of problem as soon as I moved my code to proper event it started working.

    Thanks

    Sandip

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans