-----Original Message-----
Thanks Dirk,
Your first recommendation for Question No1 works well and
it is easy.
Great.
For Question No2, unfortunately I am unable to code the tab
control, as I do not have much knowledge of VB.
I have some logic of how it should be done, but no codes.
I believe for the Form's property - On Current I need to
code an [Event Procedure] to do something like this:
Get the tab index number for the Option group (eg. 10)
Get the Option value of the Option button selected (eg. 1)
Get the tab index number for the tab inside the Tab Control
But I just found out, that the different tabs inside the
tab control have no tab index numbers:-(
So what's next?
You're being confused by the similarity between "tab index" and "page
index" on the one hand, and "tab index" and "tab control" or "tab page",
on the other. It's not actually the Tab Index property that you're
interested in at all, but the Page Index property of the tab control's
pages.
If you built your option group using the Option Group Wizard, and let it
pick the option values, it will have assigned them values in sequence --
1, 2, 3, and so on. The Page Index properties of a tab control, by
contrast, are numbered sequentially starting at 0 -- 0, 1, 2, and so on.
The simplest way to have your tab control pages correspond to the
options of the option groupc is to have page 0 correspond to option 1,
page 1 correspond to option 2, and so on. That way all you have to do
is set the tab control's value to the (option group value - 1).
Let me give you some example code. This code will use the following
"invented names" for your controls:
optMyOptionGroup
- the option group frame whose value you want to use to
determine which page is shown on the tab control.
tabMyTabControl
- the tab control you want to control.
To change pages on the tab control when the option group is updated, you
might have an event procedure for the option group like this:
Private Sub optMyOptionGroup_AfterUpdate()
Me.tabMyTabControl = Me.optMyOptionGroup - 1
End Sub
To make sure that the tab control shows the correct page as you move
from record to record, you would repeat the central line of code from
the above procedure in an event procedure for the form's Current event:
Private Sub Form_Current()
Me.tabMyTabControl = Me.optMyOptionGroup - 1
End Sub
And that would be all you need, in this ideal case. If the relationship
between the option chosen and the specific tab page is more complicated
than that, you would need slightly more elaborate code than that. Let
me know if that's the case, and if you need help with it.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.