Option buttons and tabs

  • Thread starter Thread starter Aniko
  • Start date Start date
A

Aniko

Hi,

I would like to ask two questions:
1: When a user selects an option button the appropriate tab
control with a sub form is activated. However, I would like
to lock this to the option button, and not allow the user
to change to a different tab if not changing the option
first. How is it possible?
2: When entering a new record the option button works fine
and selects the appropriate tab control. However, when
using the record navigation control and step to the next
record, the tab control does not reflect the option control
selected for the record.

Can you please help?

Thank you,
Aniko
 
Aniko said:
Hi,

I would like to ask two questions:
1: When a user selects an option button the appropriate tab
control with a sub form is activated. However, I would like
to lock this to the option button, and not allow the user
to change to a different tab if not changing the option
first. How is it possible?

One possibility: get rid of the tabs by setting the tab control's Style
property to None.

Another possibility (untested): use code in the tab control's Change
event to set the tab control back to the appropriate page as specified
by the option group. Note that you can set the tab control to a
particular page by setting its Value property to the PageIndex property
of the desired page.
2: When entering a new record the option button works fine
and selects the appropriate tab control. However, when
using the record navigation control and step to the next
record, the tab control does not reflect the option control
selected for the record.

Use the code in the form's Current event to set the tab control to the
correct page as indicated by the option group's value.
Can you please help?

Is that sufficient?
 
Thanks Dirk,

Your first recommendation for Question No1 works well and
it is easy.

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?

Your help is much appreciated.

Aniko


But I am unable to code your other recommendations
 
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.
 
Thank you so much, you cleared my confusion and solved a
problem I was having for two weeks.

Thanks again,
Aniko
-----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)


.
 
Hi Dirk,

I do not exactly know what happened, but the problem you
originally helped me with, came back.

After everything worked well in the original form, where I
designed tabs and inserted sub forms, I decided to design
the switchboard.

I tried to set up the switchboard few times, but even with
only one button on it, which was meant to take me to the
above mentioned form, did not work. Kept coming up with errors:

"Error accessing file, network connection may have been lost."

I decided to delete the switchboard and try again. No luck.
Tried to create other form with command button to link to
the form, no luck.

And then I went back to the original form, and looked at
the On Current Event Procedure and there is nothing there.
I am unable to key in anything and getting the same error
message when I try.

Pleas help,
Aniko
-----Original Message-----
Thank you so much, you cleared my confusion and solved a
problem I was having for two weeks.

Thanks again,
Aniko
-----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)


.
.
 
Aniko said:
Hi Dirk,

I do not exactly know what happened, but the problem you
originally helped me with, came back.

After everything worked well in the original form, where I
designed tabs and inserted sub forms, I decided to design
the switchboard.

I tried to set up the switchboard few times, but even with
only one button on it, which was meant to take me to the
above mentioned form, did not work. Kept coming up with errors:

"Error accessing file, network connection may have been lost."

I decided to delete the switchboard and try again. No luck.
Tried to create other form with command button to link to
the form, no luck.

And then I went back to the original form, and looked at
the On Current Event Procedure and there is nothing there.
I am unable to key in anything and getting the same error
message when I try.

Are you using Access 2000? It sounds like you've been bitten by a
particularly nasty bug. See this KB article:

http://support.microsoft.com/default.aspx?scid=kb;[LN];304548

Office 2000 SP3 fixes the bug, but that won't repair your corrupted
database. You'll have to resort to a backup, or else try importing all
objects to a new database -- some objects probably won't import, and
you'll have to recreate them from scratch. When you do import the
objects, unless you've applied the service pack, it is *crucial* that
you compile and save the project before closing the database.
 
Hi,

I spent 2 days trying to put the sp3 on Office 2000.
I had all sorts of error messages. And did three
installations unistallations :-(
Now, according to the Office update site, I have the sp3,
but I lost all the wizards. When trying to go to the
switchboard manager I get this:
Ms Access can't find the wizard or there or there is a
syntax error in the Declarations section of the visual
basic module.
The error recommends the reinstallation, which I did, but
no luck.
It is getting most frustrating,
Any idea where from there?
Thanks Dirk,
Aniko
-----Original Message-----
Aniko said:
Hi Dirk,

I do not exactly know what happened, but the problem you
originally helped me with, came back.

After everything worked well in the original form, where I
designed tabs and inserted sub forms, I decided to design
the switchboard.

I tried to set up the switchboard few times, but even with
only one button on it, which was meant to take me to the
above mentioned form, did not work. Kept coming up with errors:

"Error accessing file, network connection may have been lost."

I decided to delete the switchboard and try again. No luck.
Tried to create other form with command button to link to
the form, no luck.

And then I went back to the original form, and looked at
the On Current Event Procedure and there is nothing there.
I am unable to key in anything and getting the same error
message when I try.

Are you using Access 2000? It sounds like you've been bitten by a
particularly nasty bug. See this KB article:

http://support.microsoft.com/default.aspx?scid=kb;[LN];304548

Office 2000 SP3 fixes the bug, but that won't repair your corrupted
database. You'll have to resort to a backup, or else try importing all
objects to a new database -- some objects probably won't import, and
you'll have to recreate them from scratch. When you do import the
objects, unless you've applied the service pack, it is *crucial* that
you compile and save the project before closing the database.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Hi,

I spent 2 days trying to put the sp3 on Office 2000.
I had all sorts of error messages. And did three
installations unistallations :-(
Now, according to the Office update site, I have the sp3,
but I lost all the wizards. When trying to go to the
switchboard manager I get this:
Ms Access can't find the wizard or there or there is a
syntax error in the Declarations section of the visual
basic module.
The error recommends the reinstallation, which I did, but
no luck.
It is getting most frustrating,
Any idea where from there?

Huh, I didn't have any such problem when I applied SP3. If you haven't
already, you might try removing the Acwztool.mde file and *then* running
Repair, as directed in this KB article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;288300
ACC2000: "Microsoft Access Can't Find the Wizard..." Error Message
After You Apply the Access 2000 and SQL Server 2000 Readiness Update

As the title indicates, the article is addressing a problem that arises
from a different series of events, but following the steps set forth in
the article's "Resolution" section may still help. I'd say it's worth a
try. Let me know how it goes, please.
 
Hi Dirk,

Thank you for your reply. The file, which was mentioned in
the article was already renamed as directed by another
article which recommended to rename 3 files (Acwx*.mde) to
*.old before Sp-3 is installed. Which I did and now when
looked for the acwztool.mde file, there were no new files
created with the *.mde extension. Only the *.old was there.

Still I cut I paste all these files away from the original
folder, and ran the repair. The repair had many error
messages, saying "Error 1328. Error applying patch to file
c:\Config.msi\*.tmp. I clicked Ignore for these.
After the repair I still had the same error when trying to
open the switchboard manager. And the files were not
recreated in the original folder.

I searched the CD for these files and simply copied them to
the original folder.

Now there is no error message when accessing the
switchboard manager, but I still have the very first error
with the original database (Error accessing file...).

I recreated the form in a new database (the one with the
option buttons and tabs) by importing the original tables.

It works fine, however, when adding the switchboard, I can
fill in the necessary information for the switchboard, and
click Close, and there is no Switchboard item in the Forms
object only in the table object and cannot see it when
setting up the Startup option.

I just don't know what I am doing wrong.

Thanks for your help,
Aniko



On the other hand, I recreated
 
Hi Dirk,

Thank you for your reply. The file, which was mentioned in
the article was already renamed as directed by another
article which recommended to rename 3 files (Acwx*.mde) to
*.old before Sp-3 is installed. Which I did and now when
looked for the acwztool.mde file, there were no new files
created with the *.mde extension. Only the *.old was there.

Still I cut I paste all these files away from the original
folder, and ran the repair. The repair had many error
messages, saying "Error 1328. Error applying patch to file
c:\Config.msi\*.tmp. I clicked Ignore for these.
After the repair I still had the same error when trying to
open the switchboard manager. And the files were not
recreated in the original folder.

I searched the CD for these files and simply copied them to
the original folder.

Now there is no error message when accessing the
switchboard manager, but I still have the very first error
with the original database (Error accessing file...).

I recreated the form in a new database (the one with the
option buttons and tabs) by importing the original tables.

It works fine, however, when adding the switchboard, I can
fill in the necessary information for the switchboard, and
click Close, and there is no Switchboard item in the Forms
object only in the table object and cannot see it when
setting up the Startup option.

I just don't know what I am doing wrong.

Thanks for your help,
Aniko

The fact that you still get the "Error accessing file" message on the
original database is only to be expected -- that database is corrupt,
and applying SP3 was not expected to fix it. The error messages during
the Repair bother me, and I don't know if you've successfully fixed
things up or not. Check for missing or broken references in the new
database, in case that's what's wrong there.

I'd hate for you to have to completely uninstall Access, reinstall it,
and then apply the service pack again.
 
Hi Dirk,

I will keep trying, but I already unistalled and intalled
the whole lot 3 times and run repair 5 or 6 times.

How about the switchboard problem? What is wrong with the
switchboard?
Thanks for your help,
Aniko
 
Hi Dirk,

I will keep trying, but I already unistalled and intalled
the whole lot 3 times and run repair 5 or 6 times.

Unfortunately, there's a difference between uninstalling and "completely
uninstalling". But let's not plan to go there if we can help it.
How about the switchboard problem? What is wrong with the
switchboard?

That's what I was referring to when I suggested you check for missing or
broken references in the new database. Go into the VB Editor
environment, click Tools -> References..., and look for any references
marked MISSING. Follow the procedures Doug Steele outlines here:


http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html

That may not be the problem, but it's worth trying.

If that doesn't work, and if you can compact and zip your database down
to less than 1MB in size, you may send it to me at the address you get
by removing NO SPAM from the reply-address of this message. I'll have a
look at it, time permitting, and see if it will work for me.
 
It works :-)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thank you so much Dirk, I followed the instructions on the
link you provided. There were no missing references, but I
removed two references allowed and put them back. Now the
switchboard is working!!!!!

Now, I think we can close down this long thread; I we can
start a new one, when I come across some difficulties with
my Access project.

Your time and help was and is and well be much appreciated.

Kind regards,
Aniko
 
Aniko said:
It works :-)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Hurray! Cheers and whistles from the crowd!
Thank you so much Dirk, I followed the instructions on the
link you provided. There were no missing references, but I
removed two references allowed and put them back. Now the
switchboard is working!!!!!

Excellent. Good work.
Now, I think we can close down this long thread

Whew! That's a relief. <g>

You're very welcome.
 
Back
Top