Hide Navigation pane and tabs (1 Viewer)

Jgr4ng3

Registered User.
Local time
Today, 17:30
Joined
Jan 19, 2013
Messages
62
Hello

I'm wondering if it is possible to create a module to hide the navigation pane and document tabs? I know this is possible via the Access Current Database options however I'd prefer this to be done via an Auto Exec that runs the sub. (i already have it for the ribbon)

Also, the code to show them again would be appreciated :)

Thanks, Jake.
 

BlueIshDan

☠
Local time
Today, 13:30
Joined
May 15, 2014
Messages
1,122
Just a sec, I have 2 methods of this.
One makes cetain colors transparent, and the other hides all of the access form and only displays the forms you have created. Which of these would you prefer?
 

BlueIshDan

☠
Local time
Today, 13:30
Joined
May 15, 2014
Messages
1,122
Here is both in the load event of a form.

Note I pieced this code together from other sources a long while ago.

Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long) As Long
 
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long, _
   ByVal dwNewLong As Long) As Long
 
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal crKey As Long, _
   ByVal bAlpha As Byte, _
   ByVal dwFlags As Long) As Long
 
Private Const LWA_ALPHA     As Long = &H2
Private Const LWA_COLORKEY As Long = &H1

Private Const GWL_EXSTYLE   As Long = -20

Private Const WS_EX_LAYERED As Long = &H80000


Public Sub SetFormOpacity(hwnd As Variant, sngOpacity As Single, TColor As Long, lwa As Long)
    Dim lngStyle As Long

    ' get the current window style, then set transparency
    lngStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
    SetWindowLong hwnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED
    SetLayeredWindowAttributes hwnd, TColor, (sngOpacity * 255), lwa
End Sub

Private Sub Form_Load()
    Dim Transp As Long
    Transp = RGB(100, 200, 100) 'This is the color you want your background to be
     
    Me.Detail.BackColor = Transp
     
    Me.Painting = False

    'Set a color to be transparent on this form.
    SetFormOpacity Me.hwnd, 0.5, Transp, LWA_COLORKEY

    ' Set the visibility of the access application
    SetFormOpacity Application.hWndAccessApp, 0, Transp, LWA_ALPHA
    Me.Painting = True

    
End Sub
 
Last edited:

Jgr4ng3

Registered User.
Local time
Today, 17:30
Joined
Jan 19, 2013
Messages
62
Here is both in the load event of a form.

Note I pieced this code together from other sources a long while ago.

Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long) As Long
 
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long, _
   ByVal dwNewLong As Long) As Long
 
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal crKey As Long, _
   ByVal bAlpha As Byte, _
   ByVal dwFlags As Long) As Long
 
Private Const LWA_ALPHA     As Long = &H2
Private Const LWA_COLORKEY As Long = &H1

Private Const GWL_EXSTYLE   As Long = -20

Private Const WS_EX_LAYERED As Long = &H80000


Public Sub SetFormOpacity(hwnd As Variant, sngOpacity As Single, TColor As Long, lwa As Long)
    Dim lngStyle As Long

    ' get the current window style, then set transparency
    lngStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
    SetWindowLong hwnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED
    SetLayeredWindowAttributes hwnd, TColor, (sngOpacity * 255), lwa
End Sub

Private Sub Form_Load()
    Dim Transp As Long
    Transp = RGB(100, 200, 100) 'This is the color you want your background to be
     
    Me.Detail.BackColor = Transp
     
    Me.Painting = False

    'Set a color to be transparent on this form.
    SetFormOpacity Me.hwnd, 0.5, Transp, LWA_COLORKEY

    ' Set the visibility of the access application
    SetFormOpacity Application.hWndAccessApp, 0, Transp, LWA_ALPHA
    Me.Painting = True

    
End Sub

Hello

Thanks very much for this, are you able to break it down for me to which part, each bit of the code does? I'm a little pedantic about needing to know exactly what each piece of code I use is as if I ever need to fix anything, I have to do it almost instantly due to the uses of this DB!

Thanks, Jake.
 

Jgr4ng3

Registered User.
Local time
Today, 17:30
Joined
Jan 19, 2013
Messages
62
Look in the load event.

There are two lines commented lol.

Sorry - I'm not sure this is quite what I'm looking for - thank you though. I'm looking for a simple line of code to hide document tabs (It must be possible, everything is, right?!) ;)
 

Users who are viewing this thread

Top Bottom