Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AccpacSignonMgr - Automatic detect signed in user 1

Status
Not open for further replies.

bryan1207

Programmer
Mar 7, 2018
28
PH
Hi All,

I created a simple program and attached it inside SAGE 300 using Program Object. Now, I want that when they open the program (A) it auto-detect the current login user and company details.

Untitled_qtlh38.png


I'm using the below code, but I don't want the user to login and select again to the company.

Code:
Dim mAccpacSignOn As AccpacSignonManager.AccpacSignonMgr
Dim mAccpacSession As AccpacCOMAPI.AccpacSession
Dim mAccpacDBLink As AccpacCOMAPI.AccpacDBLink

mAccpacSignOn = New AccpacSignonManager.AccpacSignonMgr
mAccpacSession = New AccpacCOMAPI.AccpacSession

mAccpacSession.Init("", "XY", "XY1000", "61A")
mAccpacSignOn.Signon(mAccpacSession)
mAccpacDBLink = mAccpacSession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)

MsgBox(mAccpacSession.CompanyID)

Is there any other way to achieved the auto-login or Single Sign-on.

Thanks,
 
Thanks for the response, then what is the best way to do my goal?
 
Can you give me an example? Sorry, I'm just new with this platform.

Thanks,
 
Set Session = AccpacCOMAPI.AccpacSession

Session.Init "", "XY", "XY0001", "53A"
Session.Open sAccpacUser, sAccpacPW, sCompID, Date, 0, 0


Sage 300 Whisperer
 
So the variable sAccpacUser, sAccpacPW, sCompID are hardcoded? Is there anyway to automatically detect the current logged-in user?
 
Yes - add a command line parameter to your icon in Sage: $objecthandle$

Use that parameter when you .Init your session object use that value for the first parameter and you'll be connected to the same session. No need to .Open the session after that.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top