S
Shelly Jackson
I have a hidden control on a form that reflects what selections a user has
made in a list box called RegListBx
The afterupdate procedure on the RegListBx is:
Private Sub RegListBx_AfterUpdate()
Dim varItem As Variant
Dim strSQL As String
For Each varItem In RegListBx.ItemsSelected
strSQL = strSQL & RegListBx.Column(0, varItem) & ","
Next varItem
strSQL = Left(strSQL, Len(strSQL) - 1)
[RegHidden] = strSQL
RegListBx = Null
End Sub
If the user makes selections, exits the box and then goes back to the box
and deselects all selections, the following error occurs:
Run-time error '5
Invalid procedure call of argument
The line: strSQL = Left(strSQL, Len(strSQL) - 1)
is highlighted in the debugger.
How can I prevent this from occurring when the user is deselecting all of
their choices in order to select other choices?
TIA
S. Jackson
made in a list box called RegListBx
The afterupdate procedure on the RegListBx is:
Private Sub RegListBx_AfterUpdate()
Dim varItem As Variant
Dim strSQL As String
For Each varItem In RegListBx.ItemsSelected
strSQL = strSQL & RegListBx.Column(0, varItem) & ","
Next varItem
strSQL = Left(strSQL, Len(strSQL) - 1)
[RegHidden] = strSQL
RegListBx = Null
End Sub
If the user makes selections, exits the box and then goes back to the box
and deselects all selections, the following error occurs:
Run-time error '5
Invalid procedure call of argument
The line: strSQL = Left(strSQL, Len(strSQL) - 1)
is highlighted in the debugger.
How can I prevent this from occurring when the user is deselecting all of
their choices in order to select other choices?
TIA
S. Jackson