0

我正在尝试创建诸如部署数据库之类的东西,例如分发。从我的主数据库创建一个小型数据库,然后将其附加到邮件并发送给其他人。为什么我必须这样做是说来话长,但我必须这样做。

我可以创建数据库传输表查询,但我不知道如何发送属性,如下所示。如果有人有另一种方法,那也很好。必须分布在 10 个不同的地方。但我需要以锁定模式到达那里并自动弹出表单。

Public Function fnc_CreateAccessChicago()      
    Dim acApp As Access.Application
    Set acApp = New Access.Application
    acApp.Application.NewCurrentDatabase ("C:\TestTest\ChicagpDatabase")

------ acApp.Properties("StartupForm") = "frmAssetChicago" ----

    acApp.Quit   
End Function

Public Function fnc_Transfers()
    DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\TestTest\ChicagoDatabase.accdb", acTable, "tblAllAsset", "tblAllAsset"
    DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\TestTest\ChicagoDatabase.accdb", acQuery, "QryAssetChicago", "QryAssetChicago"
    DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\TestTest\ChicagoDatabase.accdb", acForm, "frmAssetChicago", "frmAssetChicagoF"
End Function
4

1 回答 1

1

尝试这个

Public Sub CopyProperties(dstDBname As String)
' copy properties from currentdb() to dstDBname
    Dim dstDB As Database
    Dim srcDB As Database
    Dim ws As Workspace
    Dim srcP As Property
    Dim dstP As Property

    Set srcDB = CurrDB()
    Set ws = DefaultWorkspaceClone()
    Set dstDB = ws.OpenDatabase(dstDBname)

    For Each srcP In srcDB.Properties
        Debug.Print srcP.Name,
        If (srcP.Name <> "Name") And (srcP.Name <> "Connection") Then
            If (Nz(srcP.value, "") <> "") Then
                Set dstP = dstDB.CreateProperty(srcP.Name, srcP.Type, Nz(srcP.value, ""))
                On Error Resume Next
                dstDB.Properties.Append dstP
                dstDB.Properties(srcP.Name).value = srcP.value
                On Error GoTo 0
            End If
            Debug.Print "set", srcP.value
        End If
        Debug.Print
    Next srcP
    dstDB.Properties.Refresh
    dstDB.Close
    Set dstDB = Nothing
    Set srcDB = Nothing
    Set ws = Nothing
End Sub
于 2013-10-07T11:10:41.347 回答