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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VBA to change from one company to another

Status
Not open for further replies.

troyddaniels

Programmer
Jan 11, 2007
28
US
I am trying to figure out the VBA script needed to switch from one database to another in Accpac ERP. Right now I am just looking at a basic switch where I will start in company 1 run the macro and end up in company 2.

I have the basic code from the document:

Set Session = CreateObject("accpac.session")
Session.Open "ADMIN", "ADMIN", "FPCOM", Date, 0, ""

But I get a "Session not initialized error"

Can anyone help me out? Thanks
 
You need something like:

Session2.Init "", "ZX", "ZX1000", "53A"
Session2.Open "ADMIN", "ADMIN", "FPCOM", Date, 0, 0



Jay Converse
IT Director
Systemlink, Inc.
 
and you need to check if a session is open and close it before opening the next company, something like:

If Session2.IsOpened Then
mDBLink2.Close
Session2.Close
End If
Session2.Init "", "ZX", "ZX1000", "53A"
Session2.Open "ADMIN", "ADMIN", "FPCOM", Date, 0, 0
Set mDBLink2 = Session2.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
 
Thanks, still working on this program. Any chance I can get you to explain the Session.Init and parameters?
 
Don't worry about it, just enter it as it is.
The parameters can be anything, they do not have any effect with the rest of the app.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top