option buttons

J

justin081

i want to use a group of option buttons to return text to a field in another
part of my form. i have tried a bunch of different code options, but cannot
seem to get the string or variable or bookmark I define in the visual basic
sub for each button to return data to a field on the main form. Any one have
any ideas?
 
D

Doug Robbins - Word MVP

Use (the equivalent of)

Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
TextBox1.Text = "One"
End If
End Sub

Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
TextBox1.Text = "Two"
End If
End Sub

Private Sub OptionButton3_Click()
If OptionButton3.Value = True Then
TextBox1.Text = "Three"
End If
End Sub

Have all of the option buttons belong to the same group.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

justin081

I have the same situation with that code as I do with all of the others I've
tried; whatever i define in visual basic, bookmarks, variables, strings, and
now text boxes never makes it back to the document. When I define bookmarks
and references, i get "reference source not found" i tried to do an equation
field and a variable, but then I get "bookmark does not exist". I think that
all of these methods would work, but that the link back to the document may
have a problem, any ideas?
I would really like to use a field of some kind versus a text box so that it
lays out in the form consistantly.
Not sure if it matters, but I'm using Word 2003
 
D

Doug Robbins - Word MVP

What type of form is this? Is it a userform (a custom dialog created as
detailed in the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

Is it a document that is Protected for Forms using FormFields

Or is is a document in which you have inserted the Radio button from the
Control Toobox toolbar.

There's horse for courses here, so we need to know exactly what it is that
you are using.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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

Top