Lock Tab Control until selection is made?

On which event are you using this code?
 
On the form where they make the entries, I'm using it on the afterupdate of my combo box.

On another form, where they just view the records I'm using it on the formCurrent event. On this form, once they leave a record that has one of the values where it needs to display a tab, but then they go to a record where no tabs are visible, the tab from the previous record remains. I've tried moving this one to a couple different events and it didn't make any difference.
 
How is the combo box getting its value? It looks like you have a number that it has but then you also have
Case "A Value NOT needing a tab"
which isn't a number. How does Case "A Value NOT needing a tab" ever occur?

Also, check to make sure that you set the tab invisible on any Case statement that is isn't needed. Without seeing your actual db and what you are doing I can't totally be sure what is happening but it would appear that you are setting it visible due to criteria but then when it really isn't needed it doesn't have hide code.

Instead of Case "A Value NOT needing a tab" you might just use

Case Else
 
thanks,
I think something happended and somehow an older version of my form got loaded.
I changed it to this

Case Else
If Len(strLastTab & "") > 0 Then
Me.tab_more_info.Pages(strLastTab).Visible = False '-- hide the Previous visible tab
End If
strLastTab = "" '-- Reset the variable to reflect no Tab open

and it started working.

Thank You for your help!!
 

Users who are viewing this thread

Back
Top Bottom