Navigation Pane Stopper

Navigation Pane Stopper

Here I demonstrate two methods of stopping the form being opened in the Navigation Pane.  The first method just stops the form being opened in the navigation pane and the second option only allows the form to be opened from an authorised form.

First Method

This code stops a Form from being opened from the Navigation Pane. This Code prevents the user from opening a Form from the navigation pane. This is necessary if you have developed a Form which should only be open from another Form. In other words, a Form that passes information back to the Form that opened it.

The terms I use for these type of Forms are “Call Called” as in you have a Form which is “Called” (the one you are opening) and you have the Form that is being opened, that’s the “Called” Form >>> Call — Called. Adapted from a Microsoft Example HERE:- Application.CurrentObjectName Property (Access)

				
					Private Sub Form_Open(Cancel As Integer)
'Application.CurrentObjectName Property (Access)
'HERE:-
'https://msdn.microsoft.com/en-us/library/office/ff196795.aspx
Dim strCurrentName As String
strCurrentName = Application.CurrentObjectName
    If strCurrentName = Me.Name Then
       Cancel = True
       Exit Sub
    End If
End Sub 'Form_Open
				
			

… …

Second Method

Here is another example demonstrating how to do something similar with the openargs event. This OpenArgs method is particularly useful because Instead of sending “Valid User” through you could, instead, send the name of the form that is doing the opening… Thus you could modify what your form does based on which form opened it.

Nicked from Microsoft – Form Object (Access)

The following example shows how to use the OpenArgs property to prevent a form from being opened from the Navigation Pane.

				
					Private Sub Form_Open(Cancel As Integer)

If Me.OpenArgs() <> "Valid User" Then
    MsgBox "You are not authorized to use this form!", _
        vbExclamation + vbOKOnly, "Invalid Access"
    Cancel = True
End If
End Sub
				
			

… …

This website uses third-party software - WordPress Add-Ins to be exact. I don't know what any individual add-in does, but I'm sure that many of them collect information about you. So be aware, if you continue using this site, then you are likely to be sharing your information. I don't know how to disable this sharing for any, or all of the plugins for individual users. So I can't stop the sharing of information. If this worries you then please do not use this site... If you continue to use this site I will assume that you are happy with it.

Do you need a hand in the right direction?

You are in the right place.