Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: AccessWindow in Category Microsoft Access : Environment from Total Visual SourceBook

Show and disable the Microsoft Access window controls to prevent users from exiting beyond your application's control using Windows API calls for 32 and 64 bit VBA.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modAccessWindow module
AccessControlBoxesVisible Procedure Show or hides the control box for the Access window. The control box is in the upper right corner and contains the minimize, maximize and close boxes.
AccessCloseButtonEnabled Procedure Enables and disables the close button of the current application. Disabling it prevents users from accidentally closing Access from the Windows close button in the upper right corner and forces users to exit within your application. For more info, visit http://www.fmsinc.com/microsoftaccess/startup/preventclose.asp
AccessWindowOpacity Procedure Set the Opacity/transparency of the Access window
AccessWindowTransparent Procedure Make the Access window completely transparent
AccessWindowSemiTransparent Procedure Make the Access window partially transparent
AccessWindowOpaque Procedure Reset the Access window to be completely opaque

Example Code for Using Module: AccessWindow

' Example of the modAccessWindow class
'
' To try this example, do the following:
' 1. Create a new form
' 2. Add the following command buttons:
'       cmdControlBox
'       cmdCloseBtn
'       cmdOpacity
'       cmdOpaque
'       cmdSemiTransparent
'       cmdTransparent
' 3. Paste all the code from this example to the new form's module
' 4. Run the form.

#If VBA7 Then
  Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long)
#Else
  Private Declare Sub Sleep Lib "kernel32" (ByVal lngMilliSeconds As Long)
#End If

Private Sub cmdCloseButton_Click()
  If cmdCloseButton.Caption = "Disable close button" Then
    AccessCloseButtonEnabled False
    cmdCloseButton.Caption = "Enable close button"
  Else
    AccessCloseButtonEnabled True
    cmdCloseButton.Caption = "Disable close button"
  End If
End Sub

Private Sub cmdControlBox_Click()
  If cmdControlBox.Caption = "Hide control box" Then
    AccessControlBoxesVisible False
    cmdControlBox.Caption = "Show control box"
  Else
    AccessControlBoxesVisible True
    cmdControlBox.Caption = "Hide control box"
  End If
End Sub

Private Sub cmdOpacity_Click()
  Select Case Me.cmdOpacity.Caption
    Case "Set window opacity: 75%"
      AccessWindowOpacity (255 * 0.75)
      Me.cmdOpacity.Caption = "Set window opacity: 50%"
    Case "Set window opacity: 50%"
      AccessWindowOpacity (255 * 0.5)
      Me.cmdOpacity.Caption = "Set window opacity: 25%"
    Case "Set window opacity: 25%"
      AccessWindowOpacity (255 * 0.25)
      Me.cmdOpacity.Caption = "Set window opacity: 75%"
    Case Else
      AccessWindowOpacity (255)
      Me.cmdOpacity.Caption = "Set window opacity: 75%"
  End Select
End Sub

Private Sub cmdOpaque_Click()
  AccessWindowOpaque
  Me.cmdOpacity.Caption = "Set window opacity: 75%"
End Sub

Private Sub cmdSemiTransparent_Click()
  AccessWindowSemiTransparent
  Me.cmdOpacity.Caption = "Set window opacity: 25%"
End Sub

Private Sub cmdTransparent_Click()
  MsgBox "Form will be transparent for 3 seconds."
  AccessWindowTransparent
  Sleep 3000
  AccessWindowOpaque
  Me.cmdOpacity.Caption = "Set window opacity: 75%"
End Sub

Private Sub Form_Load()

  ' Set defaults
  AccessCloseButtonEnabled True
  AccessControlBoxesVisible True
  AccessWindowOpaque

  ' Setup controls
  With Me.cmdCloseButton
    .Caption = "Disable close button"
    .Top = 100
    .Left = 100
    .Width = 3500
  End With
  With Me.cmdControlBox
    .Caption = "Hide control box"
    .Top = 500
    .Left = 100
    .Width = 3500
  End With
  With Me.cmdOpacity
    .Caption = "Set window opacity: 75%"
    .Top = 900
    .Left = 100
    .Width = 3500
  End With
  With Me.cmdOpaque
    .Caption = "Reset opacity"
    .Top = 1300
    .Left = 100
    .Width = 3500
  End With
  With Me.cmdSemiTransparent
    .Caption = "Make window semi-transparent"
    .Top = 1700
    .Left = 100
    .Width = 3500
  End With
  With Me.cmdTransparent
    .Caption = "Make window transparent"
    .Top = 2100
    .Left = 100
    .Width = 3500
  End With

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources