Default Form Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.

I am trying to set up a way for the tab control on my form to change based
on data in a field. For example- Say field 1 says"Baseball" and I have a tab
on my form that has criteria related only to baseball. I want access to read
that the field says "baseball" and automatically move to the corresponding
tab. Is that possilbe?

Thanks in advance!
 
On the after update event of the text box you can enter the code

Select case me.TaxtBoxName
case "Baseball"
me.TabControlName = 1 ' eneter the index number of basesball page
case "Golf"
me.TabControlName = 2
End Select
 
On the main form put code in the 'On current' event, something like:
Private Sub Form_Current()
select case field 1
case "Baseball"
TabCtl0.Pages("Baseball").SetFocus.
case else
end select

End Sub
 
Thanks for the follow up but unfortunately I am stuck.
I entered the following code:

Private Sub Account_Type_AfterUpdate()
Select Case Me.Account_Type
Case "FRON"
Me.TabCtl0 = 1
Case "MANL"
Me.TabCtl0 = 0
Case "RPLS"
Me.TabCtl0 = 0
End Select
End Sub

What I want to happen is as I move from record to record within the form, if
Account Type shows up as FRON, I want tab page 2 (Page indexed as 1) to show
automatically. If any other account type displays, I want tab page 1 Page
(indexed as 0) to show up. I am a rookie at entering code so it is feasable
that I did something wrong. What is my next step after entering the code and
saving in VB? Did I miskey something?

Thanks,
 
In the case statement enter the code
Select case ...
case 1
case 2
case else
' Anything that doesn't apply to 1 or 2
end select
 
Our form is broken down to basically two sections. The top (where account
type is) is prefilled from a datafeed at the database inception. Think of it
as a customer address field. The bottom section (where my tabs are) is
entered in during the month as we review items. So As I go from record to
record the Account Type will change because it is prefilled. Will what I am
trying to do continue to change tab pages as I move from record to record. Am
I entering the code correctly?

Thanks,
 
In that case you should enter the code in the on current event of the form,
and on the after update event of the combo as you did already.

I would create it once in the after update event, and call the after update
event sub from the on current event. that way you'll need to maintain the
code only in one place.
 
Back
Top