469,935 Members | 1,585 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

How to use toggle/option buttons on a form in Acc2003

8,435 Expert 8TB
Hi all.

I'm coming from a VB6 background so this is just confusing me a little. I have a form where the user can select one of a number of years to search. The selection doesn't relate directly to any particular table or field in the database, but will be used in code later to build queries.

I have tried putting a bunch of radio/option buttons in a frame, and also tried putting a bunch of toggle buttons on the form, and run into the same problem either way. How do I tell when one of them is selected, so I can change some defaults displayed on the form?

In VB6, of course, it would be a very simple matter to code behind the Click event. But the nearest events I can find for these controls are the KeyUp/Down and MouseUp/Down, which are really not what I want. For one thing, they still fire even if, for example, you press the mouse then move off the button, and so donít select it.

Any help is appreciated.
Oct 25 '06 #1
5 3042
MMcCarthy
14,534 Expert Mod 8TB
Drag an option group onto the form from the toolbar.

Use the wizard to set up the basic group. It will allow you to assign an integer value to each option. It will default to 1, 2, 3, etc.

Put your code in the On Click event of the Frame rather than the buttons.

Then code using select case statement

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Frame1_Click()
  3.     Select Case Frame1
  4.  
  5.     Case 1
  6.         ' do something
  7.     Case 2
  8.         ' do something
  9.     Case 3
  10.         ' do something
  11.     Else
  12.         ' do something
  13.     End Select
  14.  
  15. End Sub
  16.  
  17.  
Oct 25 '06 #2
NeoPa
32,233 Expert Mod 16PB
Radio buttons come within a frame.
The AfterUpdate event will trigger every time the operator changes the selection.
Oct 25 '06 #3
Killer42
8,435 Expert 8TB
Radio buttons come within a frame.
The AfterUpdate event will trigger every time the operator changes the selection.
Thanks to both of you. In this case I think the frame's OnClick event is the better fit for what I'm doing.
Oct 26 '06 #4
NeoPa
32,233 Expert Mod 16PB
So, beaten by a quicker AND more appropriate post... MMcCarthy does it again - Grrrr.
Seriously, it's cool you've got a good answer.
Oct 26 '06 #5
Killer42
8,435 Expert 8TB
So, beaten by a quicker AND more appropriate post... MMcCarthy does it again - Grrrr.
Seriously, it's cool you've got a good answer.
Need to brush up on those speed-typing skills. :)
Oct 26 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Neil Coleclough | last post: by
1 post views Thread by Stephen D Cook | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.