2013-07-08 99 views

回答

1

ACE數據庫引擎本質的Jet 4.0的擴展版本,並含有大量的Jet 4.0的與最重要的是,新格式的支持。因此,SQL DML和DDL語法與Jet 4.0 SQL非常相似。

我不知道是否安裝Access 2007安裝ACE提供與否。也許它是Access 2007安裝程序中的一個可選項目?在任何情況下,一個單獨的Microsoft下載存在可用於即使安裝必要的軟件,當你沒有Access 2007的。

2007 Office System Driver: Data Connectivity Components

一旦在地方的過程基本相同,與Jet這樣做。例如:

Private Sub CreateDB() 
    'Reference required: 
    ' 
    ' Microsoft ActiveX Data Objects 2.5 Library (or later). 
    ' 
    'OLEDB Provider required: 
    ' 
    ' Access Database Engine 2007. 

    Dim catDB As Object 
    Dim cnDB As ADODB.Connection 

    Set catDB = CreateObject("ADOX.Catalog") 
    With catDB 
     .Create "Provider=Microsoft.ACE.OLEDB.12.0;" _ 
       & "Data Source='D:\sample.accdb'" 
     Set cnDB = .ActiveConnection 
    End With 
    Set catDB = Nothing 
    With cnDB 
     .Execute "CREATE TABLE ClassDates(" _ 
       & "Id IDENTITY CONSTRAINT PK_UID PRIMARY KEY," _ 
       & "Student TEXT(12) WITH COMPRESSION NOT NULL," _ 
       & "ClassDate DATETIME NOT NULL," _ 
       & "PaidFor YESNO DEFAULT False," _ 
       & "CONSTRAINT StudentDates UNIQUE (" _ 
       & "Student, ClassDate))", , _ 
       adCmdText Or adExecuteNoRecords 
     .Close 
    End With 
End Sub 
+0

非常感謝。它幫助了我。如果我有進一步的疑問,我可能會回到你身邊。 –