this is mostly a question to those of you with plenty of experience.
I have a form with a listbox(listbox2) that is populated based on single or multi select items from another listbox(listbox1).
It seems the thought online is the build a UDF, creating a table parssing the values into a single paramater that is accepted by the executed stored procedure.
Currently I am achieving the same results by passing the sql statement (I know bandwidth, SQL statements are a no no), but in a high bandwidth environment would this be quicker? Here is how I am currently achieving my results. I am pretty sure I could achievethe same thing using the in operator but this does work and It is a loop requiring no user input besides selecting the items from listbox1
For Each varitem In listbox1.ItemsSelected '
strwhere = "(dbo.table.field = "
stritem = "'" & Me.listbox1.ItemData(varitem) & "'"
If x < i Then
strsp = strsp & strwhere & strposition & ") OR "
Else
strsp= strsp & strwhere & strposition & ")"
End If
x = x + 1
Next
strsql = " SELECT * " & _
" FROM table " & _
" WHERE " & strsp
listbox2.rowsource = strsql
Your thoughts?
I have a form with a listbox(listbox2) that is populated based on single or multi select items from another listbox(listbox1).
It seems the thought online is the build a UDF, creating a table parssing the values into a single paramater that is accepted by the executed stored procedure.
Currently I am achieving the same results by passing the sql statement (I know bandwidth, SQL statements are a no no), but in a high bandwidth environment would this be quicker? Here is how I am currently achieving my results. I am pretty sure I could achievethe same thing using the in operator but this does work and It is a loop requiring no user input besides selecting the items from listbox1
For Each varitem In listbox1.ItemsSelected '
strwhere = "(dbo.table.field = "
stritem = "'" & Me.listbox1.ItemData(varitem) & "'"
If x < i Then
strsp = strsp & strwhere & strposition & ") OR "
Else
strsp= strsp & strwhere & strposition & ")"
End If
x = x + 1
Next
strsql = " SELECT * " & _
" FROM table " & _
" WHERE " & strsp
listbox2.rowsource = strsql
Your thoughts?