Please Help re Code OK in VBA, not in VB re Workgroup Information File

Please Help re Code OK in VBA, not in VB re Workgroup Information File

Post by ChrisMyr » Sat, 19 Jun 1999 04:00:00



Hello VB DB'rs:

Code essentialy from the help on DAO in Access, runs w/in
that, but not in VB:

Run-time error '3358': Can't open the Microsoft Jet engine
workgroup information file - SYSTEM.MDW (in WINNT\SYSTEM32)
is there and the prg works in VBA Access97 but not in VB.

Option Explicit
Private strObjectType As String
Private strObjectName As String
Private strMsg As String

Private wrkODBC As Workspace
Private wrkJet As Workspace
Private wrkLoop As Workspace
Private prpLoop As Property
Private ctrLoop As Container
Private docLoop As Document

Private Sub Command1_Click()
Dim str_fileName As String
    CommonDialog1.ShowOpen
    str_fileName = CommonDialog1.FileName
    ContainerObjectX (str_fileName)
End Sub

Sub ContainerObjectX(str_fileName As String)

    Dim dbsNorthwind As Database

    Set dbsNorthwind = OpenDatabase(str_fileName)

    With dbsNorthwind

        ' Enumerate Containers collection.
        For Each ctrLoop In .Containers
            Debug.Print "Properties of " & ctrLoop.Name & " container"
            ' Enumerate Properties collection of each
            ' Container object.

            For Each prpLoop In ctrLoop.Properties
                Debug.Print "    " & prpLoop.Name & " = "; prpLoop
            Next prpLoop

            For Each docLoop In ctrLoop.Documents
                Debug.Print "          " & docLoop.Name
            Next docLoop
        Next ctrLoop

        .Close
    End With

End Sub

Regards, Chris

 
 
 

1. VB code vs VBA code

I need to perform several tasks against Office 2000 products from a VB6
app. I am able to locate examples of VBA code to accomplish many of
these but I am not sure how to code the same thing in plain VB (Not
VBA). For example, to import data from a spreadsheet into an Access
table in VBA I can use:

DoCmd.TransferSpreadsheet _
  TransferType:=acImport, _
  SpreadsheetType:=5, _
  TableName :="tblSample", _
  FileName:="c:\mystuff\goodstuff.xls", _
  HasFieldNames;=True

What is the right way to code this in plain VB?

TIA

Wayne

2. Include MDAC in distribution files?

3. Visual Basic DAO35 code OK but C++ code not working

4. Clarion 3.0 update patches?

5. Ok, ok, I admit it...log file help

6. GRID equivalent to browse feature

7. Workgroup Information File?

8. Modeling Topology information

9. MS Access: compress Workgroup Information File (system.mdw)

10. Problem Replicating SQL Server 2000 Database With Access 2000 Database With Workgroup Information File

11. Problem with Connection String and Workgroup Information File

12. Workgroup Information Files