vba - MS ACCESS Passing Database Property on creating new database? -
i`m trying create deploying databases distribution. create small databases main database , after attached mail , send guys. why have long story have it.
i can create databases transfer tables queries not know how send properties, below. , if has way of doing thats fine too. have distributes in 10 different places. need there in locked mode , pop form automatically.
public function fnc_createaccesschicago() dim acapp 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
try this
public sub copyproperties(dstdbname string) ' copy properties currentdb() dstdbname dim dstdb database dim srcdb database dim ws workspace dim srcp property dim dstp property set srcdb = currdb() set ws = defaultworkspaceclone() set dstdb = ws.opendatabase(dstdbname) each srcp in srcdb.properties debug.print srcp.name, if (srcp.name <> "name") , (srcp.name <> "connection") if (nz(srcp.value, "") <> "") 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
Comments
Post a Comment