Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I know how I get the value from a c 1

Status
Not open for further replies.

Tom123456

Programmer
Apr 2, 2003
70
SE
I know how I get the value from a combobox:

getText = Forms!Formname!comboName.Value

But how do i get the value (state) from a option button?

option = Forms!Formname!optionName.Value??


- Tom
 
Tom,

That should work fine! Have you tried it and it doesn't?

Sarah
 
Yes, It says that the expression doesn´t contain a value. I use this if.

If (getText = "Topic" And Forms!Formname!optionName.Value)...



- Tom
 
Similar thing to what I did (I've changed it a little to give you a better picture..

If someone selects option 1, then it displays a message and changed the option to 4:
[tt]
Code:
Private Sub Frame7_AfterUpdate()
    If Me.Frame7.Value = 1 Then
        Me.Frame7.Value = 4
        Dim Response
        Response = MsgBox("Don't be silly, you can't select a!", vbDefaultButton1, "Can't Select!") 'Send Msg
    End If
End Sub
[/tt]

You need to put it in the after update of the group frame (NOT each individual option buttons)

Hope it's of some help to you.

Aubs
 
OK. Are you using option buttons within an option group? Where you have the frame and the buttons within it? or are you using individual ones (like a check box)?

Have you dimmed the variable correctly? If you are using an option frame, plus buttons, then each button will have been given a numeric value by access, so the variable needs to be an Integer, or Long.

So you have...

Dim intOption as Integer

intOption = Forms!myformname!OptionFrameName.Value

if getText = "Topic" and intOption = 4 then.....


Then look in the properties of the button you're interested in to find the value it returns.

Or if it is an individual thing, then it'll return true or false, so you want a boolean variable

Dim bolOption as boolean

bolOption = Forms!myformname!optionbuttonname.value


Does that go any way to answering your question? Sorry if I'm barking up the wrong tree.... just post back again :)


Sarah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top