Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Display combo box for just one company

Posted on by Microsoft Employee

Hi

I have added a combo box to a screen in Dynamics SL7, but would like to hide it from all but one company, is this possible? 

I added the box at 'one group' customization level which hides it from most users, but when the users in that group log into a different company db they still have the box

Thank you for any help

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: Display combo box for just one company

    Hi Jeff

    Thank you very much.

    This worked like a charm.

    Do you know any good resources where i can learn more VBA code?

  • Verified answer
    Jeff Trotman Profile Picture
    Jeff Trotman 275 on at
    Re: Display combo box for just one company

    Here's some VBA code that should do it.

    While in Customize Mode, select Visual Basic Editor from the Customize menu.  From the code window that appears, choose Form1 from the drop down box at the top on the left, and Load from the drop down box at the top on the right.

    This should insert this into your code window:

    Private Sub Form1_Load

    End Sub

    Between these two lines, paste this code but change the "ABC" to the CpnyID that you want this to visible in, and "cdocdesc" (in 2 places) to the name of the combo box you added.

       Dim strCpnyID As String

       Call GetBufferValue("bpes.CpnyID", strCpnyID)

       If Trim(strCpnyID) = "ABC" Then

           Call setprop("cdocdesc", PROP_VISIBLE, False)

       Else

           Call setprop("cdocdesc", PROP_VISIBLE, True)

       End If

    From the Visual Basic Editor, choose File, Close and Return to Solomon Screen and then save your customization like normally. Close the screen and re-open it and the combo box should show (or not) based on the company you are logged into.

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