Assigning a paragraph of text to a optionvalue number. Can someone help?

  • Thread starter Thread starter Lucky Afternoon
  • Start date Start date
L

Lucky Afternoon

I have a fairly good understanding of Access and have built quite a few data
bases.

I'd like to know how to make text automatically populate a field when using
the option box. (of a combo box) For example, if I have an option or combo
box with 3 cities names listed, how can I make text populate another field.
I can assign the option or combo box to a field but the "valueoption" number
populates the field. (example a 1, 2, or 3) In other words, how do I assign
a paragraph of text to a valueoption? I hope I'm asking this in a way that
it is understandable. If not, I can send a small sample database to
furthur illustrate my question. I have tried using the lookup option with
another table but I don't seem to have the settings correct.

Thanks in advance to anyone who is willing to help me with this.

Dave
 
i'll look at it, dave, if you want to send your sample db
to me. reference the newsgroups in the subject line so i
don't delete your email as junk email. :)
 
Dave,
Access is correctly storing the Option Group value in the table as a number.
Leave that alone.
If you wish to show, in a report, query, or on a form, a text value based
upon the stored Option Group number, it's simple enough.
For example, in a form:
Add an Unbound Control to the Form.
Set it's Control source to (if there are just 3 options):
=IIf([OptionGroupName] = 1,"This Text",IIf([OptionGroupName]= 2,"That
Text",IIf([OptionGroupName] = 3,"Third Text","Nothing Chosen")))

Or... you could use the Choose() function in the Control's Control Source:
=IIf(IsNull([OptionGroupName]),"Nothing
Selected",Choose([OptionGroupName],"First Text","Second Text","Third
Text","Fourth Text","Fifth Text","etc."))

If you had many more options, then I would use a Select Case
statement in the Form Current Event as well as in the OptionGroup
AfterUpdate event:

Dim strText as String
Select Case OptionGroupName
Case is = 1
strText = "First Text"
Case is = 2
strText = "Second text"
etc.....
Case is = 15
strText = "Fifteenth Text"
Case else
strText = "Nothing Selected"
End Select
[ControlName] = strText
 
Back
Top