' Create an ADO record set.
set recset = CreateObject("ADODB.Recordset")
' Create the ADO connection to be used.
set MyCon = CreateObject("ADODB.Connection")
' Initialize the connection string to specify a default database. In this case, the string
' is set to the current company. However, the string can be set to a constant. For example,
' the string can be to “database=GPDAT.”
MyCon.Connectionstring = "database=" + GPConnection.GPConnInterCompanyID
' Call the GPConnection open method that is passing in the ADO connection that you created.
' When the connection returns, MyCon will be set to an open ADO connection.
GPConnection.Open(MyCon)
' Create a string to contain an update call to the customer master table.
updatecommand = "update RM00101 set [CUSTNAME]='IM Customer' where [CUSTNMBR]='AARONFIT0022'"
' Run the update command.
recset = MyCon.Execute(updatecommand )
' Close the ADO connection in the typical way.
MyCon.Close
' Retrieve the properties that are exposed by the new GPConnection object.
MsgBox GPConnection.GPConnUserDate
MsgBox GPConnection.GPConnInterCompanyID
MsgBox GPConnection.GPConnUserID
MsgBox GPConnection.GPConnUserName
MsgBox GPConnection.GPConnDataSource