Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

VBA modification error

Posted on by Microsoft Employee

I've made this little modification to "Sales Documents Print Options" screen to default 'Currency to Print' to Originating.  This works and does what intend it to do.

Curr-to-print-code.JPG

But now, when I open 'Sales Transaction' Window and click on the print button (without opening any sales doc)  it brings up the Print options screen with a Run-time Error, below

1222.error.JPG

it says that we've set a default value to a disabled field. 

this is not a hindrance to day to day work but still is there a way to remove this ?

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: VBA modification error

    Thanks

    I figured this out :)

    works alright on AfterActivate, however I'll take your advice and change it to AfterOpen

    Cheers

  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    RE: VBA modification error

    David has the correct answer here.  Sorry for my original answer.

    Tim

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,926 Most Valuable Professional on at
    RE: VBA modification error

    Hi Sinnerv

    You can only change a value of a field that is editable.

    You might need to check if the field is enabled first and wrap your code with an If then Endif.

    If CurrencyToPrint.Enabled = True Then

     CurrencyToPrint.Value = 2

    EndIf

    David

    PS: You might want to use the AfterOpen event rather than AfterActivate. Activate occurs every time you click on the window after being on another window.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: VBA modification error

    I know for a fact that we use multi-currency  and we have it enabled

  • Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 User Group Leader on at
    RE: VBA modification error

    How you checked it?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: VBA modification error

    yes we have multicurrency installed

  • Suggested answer
    Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 User Group Leader on at
    RE: VBA modification error

    Do you have Multicurrency Installed or not?

    Please reply this first and do not try to unlock /Enable any field which is locked by gp default procedures, it will mess up things.

  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    RE: VBA modification error

    <Content Removed>

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans