Diable Tab & Generate Report

chellebell1689

Registered User.
Local time
Yesterday, 20:00
Joined
Mar 23, 2015
Messages
267
I have a form "Member's Details" that has a few tabs. One tab is titled "Deacon Families" and I want to be able to either lock it, or grey it out, or something along those lines base on if the member is a deacon or not (I do have a yes/no field asking if they're a deacon). If they are NOT a deacon, the user should not be able to open the tab (because there would not be any information to show) and a pop up saying something like "This tab is empty because the member is not a deacon". If they are a deacon, I would like it to show all the members who have been assigned to them. I know this needs to be done in a subreport, but I don't know how to set it up. There is a deacon table which is linked to a family table which is linked to the member table, but the member table and deacon table are not directly linked.

I think I added enough information...let me know if more is needed or if some clarity is needed.
 
If you don't mind, can you explain it to me a bit? I get some of it...just a little lost on other parts. I italicized my thoughts for each part.

Here's the code:
Code:
Private Sub TabCtl0_Change()
'MsgBox "Changed Tab ...  " & TabCtl0.Value [I]What is this for?[/I]

Dim strInput As String
If TabCtl0.Value = 2 Then [I]Why does it have the value of 2?[/I] [I]EDIT: I get this part now!  It checks if it's on the tab that requires the password.[/I]
strInput = InputBox("Please Enter Password (Password is 1)  ", "PASSWORD REQUIRED") [I]I get this part[/I]
If strInput <> "1" Then TabCtl0.Pages.Item(0).SetFocus [I]and this part[/I]
Exit Sub

End If

End Sub
And if I understand the set up correctly, I would remove the string and change it to check if the value of "Deacon" field is true...right?
 
Last edited:
Ok, so I played around with the code a bit, but I can't get it to work. Can someone take a look and let me know what's wrong? Please?

Code:
Private Sub MemberInfoTabs_Change()
    If MemberInfoTabs.Value = 7 Then
        If Forms![Member Details]![Deacon] = True Then MemberInfoTabs.Pages.Item(7).SetFocus
        Else: MemberIngoTabs.Pages.Item(3).SetFocus
        Exit Sub
End If
End Sub

This is in the "On Change" event for the tabs. Just to be clear on what I am trying to accomplish, when the user clicks on the Deacon tab, it will check to see if the current record has true/false in the Deacon field. If it true, then it'll open the tab; if it is false, then it'll show a pop up saying the member isn't a deacon so the tab is unavailable.
 
Last edited by a moderator:
I think you should be able to adapt the code from this thread I answered what 10 Years ago! Christ, 'ave I been 'ere a long time or what!
You've been on here longer. You're an AWF Veteran. :)

Was just going to suggest that it's locked in the Current event of the form instead of the Change event of the tab control.
 
IT WORKS!! Thank you so much guys!! And thank you, Uncle Gizmo, for explaining that to me!
 

Users who are viewing this thread

Back
Top Bottom