Good afternoon (EST)
I found an article and code sample I am trying to run: How to retrieve the selected items in a multiple selection list box as a comma delimited string in microsot Access . I am running access 2003 sp3 on windows 7.
Following the example provided I get an error when opening the form: Run time error 2465 – “Access can’t find the field myselections referred to in your expression” . I have a text box per the example named mySelections on my form.
The code is:
Private Sub Form_Current()
Dim oItem As Variant
Dim bFound As Boolean
Dim sTemp As String
Dim sValue As String
Dim sChar As String
Dim iCount As Integer
Dim iListItemsCount As Integer
sTemp = Nz(Me!mySelections.Value, ” “)
iListItemsCount = 0
bFound = False
iCount = 0
Call clearListBox
For iCount = 1 To Len(sTemp) + 1
sChar = Mid(sTemp, iCount, 1)
If StrComp(sChar, “,”) = 0 Or iCount = Len(sTemp) + 1 Then
bFound = False
Do
If StrComp(Trim(Me!NamesList.ItemData(iListItemsCount)), Trim(sValue)) = 0 Then
Me!NamesList.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1
Loop Until bFound = True Or iListItemsCount = Me!NamesList.ListCount
sValue = “”
Else
sValue = sValue & sChar
End If
Next iCount
End Sub
I have searched on found remedies ranging from reinstalling sp3, turning off name auto correct, and of course confirming the text box is named properly. I continue to get the error. Is this a common error and are there any other suggestions for troubleshooting this?
Thank you for your help!