How to change Document view to Tabbed Document in MS Access runtime

Access 2007 and later versions provide some features so that one can quickly customize current application or database. which includes how the application name is displayed, how files are managed and how object windows are displayed. To manage all this, from a database that is currently open, Click the File tab. Click Options, and select settings from Application Options. With focus on the current database options "Access options dialog box will open as shown in fig 1.1.

change Document view to Tabbed Document in Ms Access runtime


 Document Window Options:-

This will select settings for how object windows appear. In previous versions of Access, all objects opened in their own windows and working with multiple windows meant constantly resizing them. Access 2007 included the option of displaying all the open objects in a series of tabs along the top of the object window. With this option, it is easier to switch between the open objects by clicking the required tab. There are options provided to set the display options from the Document Window Options area in the "Current Database" category.

Following Document Window Options are:-

Overlapping Windows

One can manually set this option, Office Button -> Access Options -> Current Database -> Overlapping Windows. When selected, multiple open objects are displayed overlapping one over the other.

Overlapping Windows


Tabbed Documents

One can manually set this option too, Office Button -> Access Options -> Current Database -> Tabbed Documents. When "Tabbed Documents" option is selected, only one object is visible at a time even if multiple objects are open in window. One can use the Tabbed Document setting without having the document tabs displayed. This would be helpful when user is working with only one object at a time. When user selects Tabbed Documents option, then user can also select the option "Display Document Tabs" to display tabs for all open objects.

Tabbed Documents


But the problem arises where the"File Ribbon is not present and we want to change these properties. At that time we could do this by using VBA Code,"

How to change Document Window Options using VBA Code:-

This procedure is helpful when you are using MS Access Runtime. Where "File Ribbon is not present to make changes into current database properties".

The property set to fulfill this is CurrentDb.Properties ("UseMDIMode"). It's 1 result for "Overlapping Windows", and 0 will result for "Tabbed Documents".

This property is supported by MS Access 2007 and later versions.This will not work more with .MDB, .MDW and Access RunTime versions erlier than 2007.

User need to close and reopen the database for the property to be changed. Here is an example shown in Fig:-2.1.1, using this code to set "Document Window Options "properties. "Change Window View" button open up a form with the options "Overlapping Windows" and "Tabbed Documents".

Customize Document Window Options using VBA Code_1


When you click on Overlapping Window button a message box appear with message to reopen the current database as shown in Fig :-2.1.2.

Customize Document Window Options using VBA Code_2


When user will reopen the database then object window will appear in overlapping view. Shown in Fig:-2.1.3.

Customize Document Window Options using VBA Code_3


User can change the view from Overlpping Window to Tabbed Documents by clicking on"Tabbed Documents" and could see changes by reopening the database.

VBA Code given below:-

Private Sub cmdOverlappingWindows_Click ()
CurrentDb.Properties ("useMDIMode") = 1
MsgBox "You must close and reopen the current database for the Specified option to take effect."
End Sub
Private Sub cmdTabbedDocuments_Click ()
CurrentDb.Properties ("useMDIMode") = 0
MsgBox "You must close and reopen the current database for the Specified option to take effect."
End Sub

NOTE:- One can check that either the current database is having "useMDIMode" property or not, by using HasProperty() method. And if it is not present then user can append the property. VBA Code for this procedure is given below:-

Public Function SetPropertyDAO() As Boolean
On Error GoTo ErrHandler
Dim obj As Object
Set obj = CurrentDb
If HasProperty (obj, "UseMDIMode") Then
obj.Properties("UseMDIMode") = False
obj.Properties. Append obj.CreateProperty ("UseMDIMode", dbByte, False)
End If
SetPropertyDAO = True
Exit Function
End Function
Private Function HasProperty(obj As Object, strPropName As String) As Boolean
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function


It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.