Hi Curtis,
Try something like this:
'Private Sub SwitchTabs_Click() --> Remove this line!
Private Function SwitchTabs(pIndex As Integer)
On Error GoTo Proc_Err
'crystal
'strive4peace2006 at yahoo.com
Me.TabNumber = pIndex
Dim mNumTabs As Integer, i As Integer, mboo As Boolean
Dim Fore1 As Long, Fore2 As Long, Back1 As Long, Back2 As Long
Fore1 = 16777215
Back1 = 11220286
Fore2 = 8388608
Back2 = 16644084
mNumTabs = 2
For i = 1 To mNumTabs
If pIndex = i Then
Me("tab" & i).BackColor = Back1
Me("tab" & i).ForeColor = Fore1
Else
Me("tab" & i).BackColor = Back2
Me("tab" & i).ForeColor = Fore2
End If
Next i
Me.TabSubform.Visible = True
Me.TabSubform.SetFocus
Select Case pIndex
Case 1
Me.TabSubform.SourceObject = "Potential"
Case 2
Me.TabSubform.SourceObject = "CurrentForm"
End Select
Proc_Exit:
Exit Function
Proc_Err:
MsgBox Err.Description, , "ERROR " & Err.Number & " SwitchTabs"
'press F8 to step through lines of code to see where problem is
'comment next line after debugged
Stop: Resume
Resume Proc_Exit
End Function
'End Function --> Remove this line!
~~~~~~~~~~~~~~~~~
make sure you have these buttons
Name --> Tab1
Caption --> Potential
Onclick --> =SwitchTabs(1)
Name --> Tab2
Caption --> CurrentForm '--> changed name from Current
Onclick --> =SwitchTabs(2)
and this textbox:
Name --> TabNumber
~~~~~~~~~~~~~~~~~~
you are going to run into problems with a form name of Current -- you
need to change that, so I changed it in the example
Warm Regards,
Crystal
*
have an awesome day
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*