Access CloseCurrentDatabase Method Example
CloseCurrentDatabase Method - You can use the CloseCurrentDatabase method
to close the current database (either a Microsoft Access database (.mdb) or an
Access project (.adp) from another application that has opened a database
We have dozens of downloadable Access small business databases for you to learn and examine.
15 years ago we were putting Access database on the web using Active Server Page (ASP) programming language for the user interface. See examples of Access on the Internet.
Here is a little example the opens another Access database and creates a form,
then closed the database. Can you envision the uses of this technique to
write temporary table to another database (creating the database on the fly)?
Option Compare Database
Dim appAccess As Access.Application
Const strDBPath = "C:\My_DBs\"
Dim frm As Form
Dim strDB As String
' setup string to current database path.
strDB = strDBPath & "the_database.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
' Create a new form.
Set frm = appAccess.CreateForm
' Save the new form.
appAccess.DoCmd.Save , "New_Form"
' Close the newly opened database.
Set appAccess = Nothing