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!

add multiple values to a text box

Status
Not open for further replies.

SnoWBunnY

Programmer
Jul 4, 2002
13
CA
Hey!

this is my little problem . . . . I have a few checkboxes on my form, they are not part of the option group because of multiple selections. When I do a report I want to show the ones that have been selected without having to add all of them in the report so I wanted to add a text box on my form that collects all of the checkboxes that have been selected but have no clue how to add them, I can add 1 but more than one is a mystery to me.

so say my checkboxes are n/a, well orientated, ambulatory, sedated . . . . . . and well orientated and ambulatory have been selected, I want the text box to say "well orientated, ambulatory"

any help would be greatly appreciated
thanks
=o)
 
After you change this function, call this function from the AfterUpdate event of each check box...

Private Function UpdateText()

Dim StrText as String

strText = ""

' Do this for each check box...
If me.chkBox1 then
strtext = strText & "My result1, "
End if

IF me.chkBox2 then
strText = strtext & "My Result2, "
End if

' This eliminates the comma at the end...
If Len(strText) > 2 then
strText = Left(strtext, Len(strText) -2)
End if

' Set the text box...
Me.txtBox = strText

End Function

Hope that helps...

Gary
gwinn7
A+, Network+
 
Place this code in the ControlSource of your forms new TextBox.

=IIF(me![WellOrient],"well orientated ","") & IIF(me![Ambulatory],", ambulatory ","") & IIF(me![Sedated],", sedated ","")

You can also have a similar control in your reports Detail Section but you must also have controls for each of the data fields that you are analyzing.

Another way is to create a query to use as the Record Source for your report and use this type of IIF function statement to create a new field with the text representation of the fields in your table.

TextDesc: IIF([tblYourTable]![WellOrient],"well orientated ","") & IIF(([tblYourTable]![Ambulatory],", ambulatory ","") & IIF(([tblYourTable]![Sedated],", sedated ","")

Let me know if you need more help with this.

Bob Scriver
 
W o W
thank you very very much
your help is GrEaTly appreciated
=o)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top