Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links
Application Object Examples
Close Current Database Code Example

Visual Basic Application Objects

 





Access Error
AddToFavorites
BuildCriteria
CloseCurrentDatabase
CodeDB
CompactRepair
ConvertAccessProject


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 through Automation.



Microsoft Access is a fully capable database and it's primary limitations is the number of concurrent users it will support. Generally, we recommend a limit of 10 to 15 users.

Did you know you don't need to move to SQL/Server to run and manage your Access database on the net. There are many alternative solutions. Among them are Amazon's AWS cloud services and various hosting services in nearly every state.


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

Sub CreateForm()
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.
appAccess.OpenCurrentDatabase strDB
      ' Create a new form.
Set frm = appAccess.CreateForm
      ' Save the new form.
appAccess.DoCmd.Save , "New_Form"
      ' Close the newly opened database.
appAccess.CloseCurrentDatabase
      ' Cleanup
Set appAccess = Nothing

End Sub








A Blue Claw Database Design Article:

Why Choose Microsoft Access
 





Blue Claw Database Design Downloadable Tutorial:
Download Continuous Form Dependent Combo Box  





A Blue Claw Software Design Template:

Customer Relationship Management (CRM) Template
 



Contact Information

Copyright 2000-2017 Blue Claw Database Design