Announcements
I've looked in every SL doc I could find but still I am not able to answer what should be a simple question: how do we access the company switch button in the SL toolbar (upper right hand corner) and read which company is selected from our VBA / VB app?
I need to know if the company has been switched and which company id / company name was selected.
Any help or ideas would be most appreciated.
Thank you!
*This post is locked for comments
Ah ... I did see the PES table ... now it is making sense.
I am customizing standard screens.
I did tried code similar to yours but it didn't work for me so I will need to dig a little further. why it is not working.
thank you for setting me onto the right direction
the pes table is located in the system database. Each screen includes that table as one of the modules and opens it to the record that is just for the user's particular session. SWIM always refers to tables with a prefix of "b" so that is why, in your code or in a customization you refer to it a bpes.
You did not indicate whether the screen is a standard SL screen or an SDK developed screen.
Here is just a simple example of a code segment added via customization manager. This sample does nothing but demonstrates how to fetch the current company id.
Private Sub ccustid_Chk(ChkStrg As String, retval As Integer)
Dim test As String
test = bpes.cpnyid
End Sub
Rick is it possible I am not using a "bpes" table?
I am not finding it anywhere in my database or tempdb. Perhaps I have to activate?
Either way. I am probably going to stick with the customizations and then call a DLL written in C# to do most of the processing. So bpes only has the active company (one record) and not the rest of those listed in the Company table? For some reason I thought it held all of the available companies in it.
Now that I could work with. Thank you again!
Are you trying to do this with a customization or are you trying to do this in an SDK developed screen? The bpes table is available to any SL screen and should be to any SDK developed screen. bpes will also contain just the information for the current session for that user.
Perhaps you need to explain a bit more about exactly what you are trying to do and the purpose for doing it. It sounds like you want the current company id so that you can use that in a subsequent query but I cannot tell for sure from your posts so far.
Thank you Rick for your response!
I have seen some code about bpes, but nothing as to which is the active (or new) CpnyID which each screen which I can use to query any table. Do you have any code samples for determining the currently active CpnyID in the current screen?
From a code segment, use the table bpes. the company ID is in the field called CpnyID and the company name is in the field CpnyName. bpes is included in every screen.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156