T
Tom
I have an application that uses SQL Server 2000 as the backend and an
MS-Access .ADP file as its front-end.
The front-end has an unbound form that contains a listbox, textbox, and a
command button.
The listbox's RowSource is TableA. The listbox's column(0) is from Field_1
of TableA. It's column(1) (not visible) is the Prime Key of TableA.
When the OnClick event of the command button fires, the text box is checked
for the presence of a text string. If the textbox is blank, ALL records of
TableA are shown in the list box.
If the text box contains text, the list box shows all records whose Field_1
contains the text string from the text box (ie. LIKE '%<string>%').
I have a stored procedure that returns the desired recordset based on
several input parameters (of which the contents of the text box is just one.
For simplicity, I won't discuss the others here). I used a listbox because I
want the user to have a "multi-select" capability. When they find all
records containing their search string, they have the option of selecting one
or more records and assigning values (not discussed here) to the selected
records. Note: when the text box is blank, I can potentially return 20,000+
records.
My question is this: What is the best way to set the RowSource of the list
box based on several input parameters including the contents of the text box?
Can I use my stored procedure and pass it its input parameters? How?
If you could point me to an example of how to do this, I would really
appreciate it.
Thank you ahead of time for any assistance you can provide!
MS-Access .ADP file as its front-end.
The front-end has an unbound form that contains a listbox, textbox, and a
command button.
The listbox's RowSource is TableA. The listbox's column(0) is from Field_1
of TableA. It's column(1) (not visible) is the Prime Key of TableA.
When the OnClick event of the command button fires, the text box is checked
for the presence of a text string. If the textbox is blank, ALL records of
TableA are shown in the list box.
If the text box contains text, the list box shows all records whose Field_1
contains the text string from the text box (ie. LIKE '%<string>%').
I have a stored procedure that returns the desired recordset based on
several input parameters (of which the contents of the text box is just one.
For simplicity, I won't discuss the others here). I used a listbox because I
want the user to have a "multi-select" capability. When they find all
records containing their search string, they have the option of selecting one
or more records and assigning values (not discussed here) to the selected
records. Note: when the text box is blank, I can potentially return 20,000+
records.
My question is this: What is the best way to set the RowSource of the list
box based on several input parameters including the contents of the text box?
Can I use my stored procedure and pass it its input parameters? How?
If you could point me to an example of how to do this, I would really
appreciate it.
Thank you ahead of time for any assistance you can provide!