OpenCompany

Method
Opens a company in an open database.

Category
Database

 

Syntax
Sub OpenCompany(ByVal CompanyName As String)

CompanyName
The company to open.

 

Example

'Case "OpenCompany"

'Opens the Company entered in Parameters

  tmpVar = CF1.CompanyName

  If (CStr(tmpVar) = "") And VarType(tmpVar) = vbString Then

  logWr "CompanyName with closed company: OK "

  Else

  logWr "CompanyName with closed company failed (" + tmpVar + ")"

  End If

 

  CF1.OpenCompany .Text1(cf.CompanyName)

  logWr "Company Opened: " + .Text1(cf.CompanyName)

 

  tmpVar = CF1.CompanyName

  If VarType(tmpVar) = vbString And tmpVar <> "" Then

  logWr "CompanyName with open company: OK (" + CStr(tmpVar) + ")"

  Else

  logWr "CompanyName with open company: failed"

  End If

 

Comments
OpenCompany allows an application to select a company and thereby open tables and access data (records) from the database.

An application can have only one company open at a time, but it can have many tables open, provided they are in the same company.

In a multiuser environment, different applications can access different companies within a single database (via a server), but each application can only have one company open at a time.

If CompanyName does not exist, the function raises an exception.

For more information about companies, see the Application Designer's Guide.



© 2009 Microsoft Corporation. All rights reserved.