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

Macros database link to another company 3

Status
Not open for further replies.

iwells

Programmer
Oct 2, 2012
284
CA
Hi,

Is it possible to create a database link to another company other than the database the user is currently logged in to? If so, how?

Through some of the my other posts I've found the macro uses the current session information for the dblink to the company you're logged in to which is great because the user is logged in to the company I want to grab the information I need, but the information needs to go in to a different database which the user isn't logged into. They could in theory log in to that company however.

Basically I need to do an information pull from Company A to Company B through a macro and I'm looking to do it through the API rather than the existing ADO if possible.

If the user is logged in to company A, how do I connect to company B through a session/database link? Both companies are on the same SQL server.

Thanks

 
Use CS0120 to read the data you need from the other company, it takes an SQL query as input.
Then do:

Do while view.GoNext
.... your code
Loop

No Browse filter needed, no test for EOF or BOF.

Sage 300 Certified Consultant
 
One important thing to do with CS0120:

.Browse "your sql statement here", true
.InternalSet 256 <- You must use this line if your .Browse is returning a recordset that you want to access. Otherwise you'll get errors when you access the fields.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top