Dim strPass As String
Dim strverify As String
strPass = "password"
strverify = InputBox("what is the password to view the tab?")
If strPass <> strverify Then
Me.Page1.SetFocus
Me.Page2.Visible = False
Else
Me.Page2.SetFocus
Me.Page2.Visible = True
End If
Private Sub NavigationButton63_Click()
Dim strPass As String
Dim strverify As String
strPass = "password"
strverify = InputBox("what is the password to view the tab?")
If strPass <> strverify Then
Exit Sub
Else
Me.NavigationSubform.SetFocus
DoCmd.OpenForm "Distribution List Form", acNormal
End If
End Sub
Thanks Nigel. I am actually using your way to create one for myself. But, I do not know how to call my navigation buttons.I have navigation buttons with names of NavigationButton1,NavigationButton2,.... . Furthermore, each of this navigation button targets to an existing form outside the navigation form. I cannot find something like "maintab" in my navigation form. Here is my code:
Code:Private Sub cmdLogin_Click() Dim intPages As Integer For intPages = 1 To Me.NavigationButton.Pages.Count - 1 Me.NavigationButton.Pages(intPages).Visible = (Me.txtPassword & vbNullString = "abc") Next intPages If Me.NavigationButton.Pages(1).Visible Then Me.NavigationButton = 1 End Sub
Private Sub cmdLogin_Click()
Dim intControls As Integer, maxControls as Integer
maxControls = (Largest number of your Command Buttons)
For intControls = 1 To maxControls
' If your first controls are numbered 1 - 9, which I suspect they are
Me.Controls("NavigationButton" & intControl).Visible = (Me.txtPassword & vbNullString = "abc")
' If your first controls are numbered 01 - 09
' Me.Controls("NavigationButton" & Format(intControl, "00")).Visible = (Me.txtPassword & vbNullString = "abc")
Next intControls
If Me.NavigationButton1.Visible Then Me.NavigationButton1.Setfocus
End Sub
Private Sub cmdLogin_Click()
Dim intControls As Integer, maxControls As Integer
maxControls = 6
For intControls = 1 To maxControls
' If your first controls are numbered 1 - 9, which I suspect they are
'Me.Controls("NavigationButton" & intControl).Visible = (Me.txtPassword & vbNullString = "abc")
' If your first controls are numbered 01 - 09
Me.Controls("NavigationButton" & Format(intControl, "00")).Visible = (Me.txtPassword & vbNullString = "abc")
Next intControls
If Me.NavigationButton01.Visible Then Me.NavigationButton01.SetFocus
End Sub
If Me.NavigationButton01.Visible Then Me.NavigationButton01.SetFocus
[Forms]![Navigation Form]![NavigationButton01].Visible
Me!NavigationButton01.Visible
Me.Controls("NavigationButtons01").Visible
Me.Controls("NavigationButton" & Format(intControl, "00")).Visible = (Me.txtPassword & vbNullString = "abc")
[Forms]![Navigation Form]!["NavigationButton" & Format(intControl, "00")].Visible = (Me.txtPassword & vbNullString = "abc")
Private Sub cmdLogin_Click()
Dim intControls As Integer, maxControls As Integer
maxControls = 6
For intControls = 1 To maxControls
' If your first controls are numbered 01 - 09
Me.Controls("NavigationButton" & Format(intControl[COLOR="Red"]s[/COLOR], "00")).Visible = (Me.txtPassword & vbNullString = "abc")
Next intControls
If Me.NavigationButton01.Visible Then Me.NavigationButton01.SetFocus
End Sub