Templates: Programmability

Now that we talked about what Access 2007 templates are made of and how Access makes use of them to create brand new databases, it begs the question as to what you can programmability-wise.

 

The answer to that question lies in the fact that we changed Application.NewCurrentDatabase by adding a new couple of optional arguments. Here is the new signature of this function:

Sub Application.NewCurrentDatabase(filepath As String, _

Optional FileFormat As AcFileFormat, _

Optional Template As Variant, _

Optional SiteAddress As String, _

Optional ListID As String)

Here are the new optional arguments:

· Template - String path to the template to instantiate or an integer SharePoint list template ID;

· SiteAddress - URL to the SharePoint site to link to;

· ListID - GUID or Name of the list to link to;

As we mentioned before, templates can be closely tied to SharePoint. The last two parameters allow you to instantiate a template and link to a SharePoint site in the process. Under the covers, this is very similar to the functionality made available through DoCmd.TransferSharePointList, which links SharePoint lists.