View Full Version : displaying titles of true/false fields
xzyragon
10-08-2012, 01:41 PM
Hey guys,
I couldn't find any results on this, but it was probably because i wasn't wording it right.  ANYWAY, i have a series of true / false fields being checked off in a form, but on a query, I only want the true fields to be shown, and have them all shown in one cell.  I have a medication check off list, where doctors check off what meds are prescribed, and then I want those meds simplified into a box, separated by a comma.  Like: Morphine,Avinza,Clonazepam... etc.
Thanks for the help
BrianMH
10-11-2012, 09:22 AM
You would need to set an action for each check box to update that field if the field didn't already contain the string and remove the string if it did when unticked.
A list box with multiselect would probably be easier.
xzyragon
11-29-2012, 03:22 PM
so i can't bind a multi-select list to a field.  Is there a way to update a field to contain everything in the multiselect list box per individual?
BrianMH
11-30-2012, 01:25 AM
To avoid reinventing the wheel I googled it and found http://bytes.com/topic/access/answers/855151-multiple-select-listbox-concatenate-single-field-table
 
You could bind a textbox control to the field and then use this code to update that textbox.
 
Private Sub ListBoxName_Click() 
    Dim strSelected As String 
    Dim varItem As Variant 
  
    With Me.ListBoxName 
        For Each varItem In .ItemsSelected 
            strSelected = strSelected & "," & .ItemData(varItem) 
        Next varItem 
        Me.FormControlToPopulate = Mid(strSelected, 2) 
    End With 
End Sub
xzyragon
12-03-2012, 04:23 PM
it worked!  But is there a way to deselect all the previous selections for each new entry?  Ideally would  be a way to save each selection for each entry in the form, but i would be fine with something that would just deselect everything.
BrianMH
12-05-2012, 04:40 AM
You could cycle through the checkboxes and use an if statement to decide whether or not it is checked based on what is in the text box field.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.