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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi select list box problem

Status
Not open for further replies.

jwoodland

Technical User
Oct 29, 2002
11
GB
I have the following code in the AdfterUpdate event of a simple multi select listbox. The code puts the selected items in order (separated by commas) and works fine. However when I scroll through other records, the listbox doesn't update to show the current selection in the new record. Here is the code;

Private Sub List201_AfterUpdate()
Dim varItem As Variant
Dim txtTemp As String
For Each varItem In Me.List201.ItemsSelected
txtTemp = txtTemp & Me.List201.ItemData(varItem) & ","
Next
If Len(txtTemp) > 0 Then
txtTemp = Left(txtTemp, Len(txtTemp) - 1)
End If
Me.HowMany.Value = txtTemp
End Sub

Any pointers would be great!!
 
The list box has two columns (number and description) and stores the values in the field text 'HowMany' like 1,2,3 etc....
 
stores the values in the field text 'HowMany' like 1,2,3 etc....
Have a look here:

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I know, I know this isn't 'grammatically' correct but this is only a simple single user database to input questionnaire responses and perform simple analysis, so this technique fits the purpose for this database.

Thanks anyway PHV!
 
You have already run into one of the problems you will encounter through not having a relational set-up. You must parse the field in an On Current event and mark each value as selected. There will be more difficulties when you come to analyse the data.
 
How are ya jwoodland . . .

Agree with [blue]PHV[/blue] & [blue]Remou[/blue]. Your definitely headed for trouble here!
jwoodland said:
[blue] . . .[purple]this is only a simple single user database[/purple] to input questionnaire responses and perform simple analysis . . .[/blue]
It won't be [purple]simple[/purple] long before your done!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top