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

Passing List box data to query

Status
Not open for further replies.

dm5085

Technical User
Jul 15, 2004
17
I have a form that has a multi-select list box. I've succeeded passing the string value to a query but my query won't pull any records I suspect because I can't figure out how to delete the last "OR" from the string.

Here's my sub:



Private Sub lstStatus_AfterUpdate()

Dim AwardStatus As Variant
Dim strAwardSel As String
Dim AwardList As String

For Each AwardStatus In Me![lstStatus].ItemsSelected()
If Len(strAwardSel) <> 0 Then strAwardSel = strAwardSel
strAwardSel = strAwardSel & Me![lstStatus].Column(0, AwardStatus) & " OR "
' & "," & Me![lstStatus].Column(1, AwardStatus)
Next AwardStatus

Me.AwardList = strAwardSel

End Sub


Can anyone help? I know there are dozen's of threads out there but I couldn't find one to address this.

Thanks!
 
use left and len to drop the " or "

left(strAwardSel,len(strAwardSel)-4)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top