Option events

craigcain

Registered User.
Local time
Today, 16:00
Joined
Sep 26, 2007
Messages
15
Hi,

I am having a problem creating some code for some option buttons. I am using these over a picture background (scan of a paper form) so that the user can easily enter the info.

however this leaves me with over 200 option buttons to code. I am using a textbox under the picture so that when you choose one of the options, the right info is displayed (txtOptionChosen)

Code:
Private Sub Option419_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.txtOptionChosen.Value = "Fatal Accident to Member of Public - Fall from Scaffolding Structure"
End Sub

Private Sub Option421_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.txtOptionChosen.Value = "Major Accident to Member of Public - Fall from Scaffolding Structure"
End Sub

Private Sub Option423_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.txtOptionChosen.Value = "3 Day Accident to Member of Public - Fall from Scaffolding Structure"
End Sub

This is the way I started coding before I thought about how much writing this would involve!

I thought about using:

Dim message1 as String
message1 = "Fatal accident to member of public"

and adding the rest in but this would still involve writing separate code for each button. Maybe I will need to but I want to make sure before I do!

I can post the picture here if that will help?

Craig
 
If using option buttons (truly option buttons where ONE option is selected from among a group of them) if you use an OPTION GROUP instead of individual buttons you just code within the AfterUpdate event of the OPTION GROUP itself and not the individual buttons.
 
I have used an option group. I will look the afterupdate. should have known as I used it somewhere else.

Thanks
 

Users who are viewing this thread

Back
Top Bottom