toggle button

I

iccsi

I have toggle buttons on my frame and would like to pass control name
to my function.

I have code on GetFocus for the toggle button.

When I check my fucntion Screen.ActiveControl.Name shows my frame
name, but not my toggle button name.

Are there any way to get Screen.ActiveControl.Name for toggle button
on the frame?


Your help is great appreciated,
 
A

Allen Browne

What are you trying to do?

As you found, the option group is the active control, not the buttons it
contains. You can examine the Value of the group, and compare it to the
OptionValue of the buttons if you want to match them.
 
I

iccsi

What are you trying to do?

As you found, the option group is the active control, not the buttons it
contains. You can examine the Value of the group, and compare it to the
OptionValue of the buttons if you want to match them.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.










- Show quoted text -

Thanks for helping,

I have many frame in the form and to udpate my physical table when
user click.
Because there are 10 frames on the form and 30 toggle buttons on the
form, each frame has 3 toggle button.

I just wanted to have a general function to handle all the toggle
button.

I pass the control to the function, but the funciton only recieve
frame name.

Are there any work around for this?

Thanks millions,
 
A

Allen Browne

For a normal bound form, no handling is needed.

You create a table with a field of type Number.
You create a form with an option group bound to the Number field.
When the user depresses a toggle button, that becomes the value of the
option group. Access than saves this number into the Number field. No
handling is necessary.

If you need to do something else, please let us know. One fairly common
approach might be to create a small lookup table with 2 fields like this:
SomeID Number
SomeDescrip Text
You can then add a record for each button in your option group. The number
matches the button's OptionValue, and the description explains what this
number means. Doing this, you can include this table in a query, and so the
description onto your report.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

What are you trying to do?

As you found, the option group is the active control, not the buttons it
contains. You can examine the Value of the group, and compare it to the
OptionValue of the buttons if you want to match them.










- Show quoted text -

Thanks for helping,

I have many frame in the form and to udpate my physical table when
user click.
Because there are 10 frames on the form and 30 toggle buttons on the
form, each frame has 3 toggle button.

I just wanted to have a general function to handle all the toggle
button.

I pass the control to the function, but the funciton only recieve
frame name.

Are there any work around for this?

Thanks millions,
 
I

iccsi

For a normal bound form, no handling is needed.

You create a table with a field of type Number.
You create a form with an option group bound to the Number field.
When the user depresses a toggle button, that becomes the value of the
option group. Access than saves this number into the Number field. No
handling is necessary.

If you need to do something else, please let us know. One fairly common
approach might be to create a small lookup table with 2 fields like this:
    SomeID            Number
    SomeDescrip    Text
You can then add a record for each button in your option group. The number
matches the button's OptionValue, and the description explains what this
number means. Doing this, you can include this table in a query, and so the
description onto your report.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.







Thanks for helping,

I have many frame in the form and to udpate my physical table when
user click.
Because there are 10 frames on the form and 30 toggle buttons on the
form, each frame has 3 toggle button.

I just wanted to have a general function to handle all the toggle
button.

I pass the control to the function, but the funciton only recieve
frame name.

Are there any work around for this?

Thanks millions,- Hide quoted text -

- Show quoted text -

Thanks for helping,

I use unbound form, so I need update table by myself.

Thanks again,
 
I

iccsi

For a normal bound form, no handling is needed.

You create a table with a field of type Number.
You create a form with an option group bound to the Number field.
When the user depresses a toggle button, that becomes the value of the
option group. Access than saves this number into the Number field. No
handling is necessary.

If you need to do something else, please let us know. One fairly common
approach might be to create a small lookup table with 2 fields like this:
    SomeID            Number
    SomeDescrip    Text
You can then add a record for each button in your option group. The number
matches the button's OptionValue, and the description explains what this
number means. Doing this, you can include this table in a query, and so the
description onto your report.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.







Thanks for helping,

I have many frame in the form and to udpate my physical table when
user click.
Because there are 10 frames on the form and 30 toggle buttons on the
form, each frame has 3 toggle button.

I just wanted to have a general function to handle all the toggle
button.

I pass the control to the function, but the funciton only recieve
frame name.

Are there any work around for this?

Thanks millions,- Hide quoted text -

- Show quoted text -

I tried to use one function to handle 30 toggle buttons on 10 frames
for unbound form, since I need take care of update, insert, delete by
VBA code.

Is it possible to have one function to handle the situation?

Your help is great appreciated,
 
A

Allen Browne

I tried to use one function to handle 30 toggle buttons on 10 frames
for unbound form, since I need take care of update, insert, delete by
VBA code.

Is it possible to have one function to handle the situation?

It probably is.

But it would make much more sense to use a bound form.
(Even if you did know how to write the code.)
 
I

iccsi

It probably is.

But it would make much more sense to use a bound form.
(Even if you did know how to write the code.)

Thanks for helping,
Understood.
The problem is the whole application started as unbound form.
It takes more time to do this part as bound form.

I just realized that how imprtant of application design.

I found a solution to use onExit on the frame then access the value ot
the frame from my function and create a macro to call the function.

In the form just fill the macro name then I have one function to take
care 30 toggle buttons on 10 frames.

This case I only have one function to maintain.

Thanks again,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top