Hello, I have been working on a database with the help of some of the users of experts exchange and I was hoping I could get some comments about how to change how my form's list boxes are functioning. I have several list boxes (in multi-select mode simple) all of which pass their values to a variable nst and then this value is passed onto the [notes] field on my form/table. The way the list boxes function now works pretty well, but when a user attempts to deselect his or her listbox choice the entire field nst is cleared. The code for the list boxes right now is as follows:
Does anyone know if it is possible to accomplish what I have requested, and if so how should the above code be modified?
Thanks in advance for any comments,
Private Sub List58_AfterUpdate()
If .Selected(.ListIndex) = True Then
If nst = "" Then
nst = .Column(0, .ListIndex)
If InStr(nst, .Column(0, .ListIndex)) = 0 Then
nst = nst & ", " & .Column(0, .ListIndex)
If InStr(rst, ",") > 0 Then
If InStr(nst, .Column(0, .ListIndex)) = 1 Then
nst = Replace(nst, .Column(0, .ListIndex) & ", ", "")
nst = Replace(nst, ", " & .Column(0, .ListIndex), "")
nst = ""
Me.[Notes] = nst