Create Method Example (VB)

Microsoft ActiveX Data Objects (ADO)

ADOX 2.5

Create Method Example (VB)

The following code shows how to create a new Microsoft Jet database with the Create method.

' BeginCreateDatabseVB
Sub CreateDatabase()
    On Error GoTo CreateDatabaseError
    
    Dim cat As New ADOX.Catalog
    cat.Create "Provider='Microsoft.Jet.OLEDB.4.0';Data Source='c:\new.mdb'"

    'Clean up
    Set cat = Nothing
    Exit Sub
    
CreateDatabaseError:
    Set cat = Nothing

    If Err <> 0 Then
        MsgBox Err.Source & "-->" & Err.Description, , "Error"
    End If
End Sub
' EndCreateDatabaseVB

See Also

Catalog Object | Create Method

© 1998-2003 Microsoft Corporation. All rights reserved.