Passing option group value to vba function

  • Follow


I'm sure I've done this before but can't for the life of me figure it
out now, and hours of research online haven't helped. I'm simply
trying to pass an option group value from a form to a vba function.
I'd like the user to choose option1 or option2 and when they click a
button, the function will run an if statement like "if
option1.value=true then...."

I've got 2 options named option1 and option2 and a frame called
frame20, what else do I need? I've also tried bounding the selection
to a textbox, but keep getting errors. Any help on the process?

Thanks,
Angelo

0
Reply Muscat 8/6/2007 2:57:33 PM

If you set up the function as below, you can call it like this:
    Call MyFunc(Me.frame20)

Function MyFunc(grp As OptionGroup)
    Select case grp.Value
    Case 1
        MsgBox "Option value is 1."
    Case 2
        MsgBox "Option value is 2."
    Case Else
        MsgBox "Huh?"
    End Select
End Function

-- 
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.

<Muscat.Angelo@gmail.com> wrote in message 
news:1186412253.685239.159910@o61g2000hsh.googlegroups.com...
> I'm sure I've done this before but can't for the life of me figure it
> out now, and hours of research online haven't helped. I'm simply
> trying to pass an option group value from a form to a vba function.
> I'd like the user to choose option1 or option2 and when they click a
> button, the function will run an if statement like "if
> option1.value=true then...."
>
> I've got 2 options named option1 and option2 and a frame called
> frame20, what else do I need? I've also tried bounding the selection
> to a textbox, but keep getting errors. Any help on the process?
>
> Thanks,
> Angelo
> 

0
Reply Allen 8/6/2007 3:15:32 PM


1 Replies
2785 Views

(page loaded in 0.001 seconds)

Similiar Articles:
















7/22/2012 7:12:15 AM


Reply: