In one of my report's form, users can choose several controls to run their query on:
ID: ...
or Product name: ...
or Comment: ...
or Category: ...
then, depending on their answer, I fill a variable ("query") to complete my SQL query:
Code: Select all
if (TextBoxControl1.Text!="")
{query=query+" and ID="+TextBoxControl1.Text;}
if (ComboBoxControl1.SelectedItem!=null)
{query=query+" and inventaire.[Product_name]='"+ComboBoxControl1.Control.Text+"'";}
if (TextBoxControl2.Text!="")
{query=query+" and Comments='"+TextBoxControl2.Text+"'";}
if (ComboBoxControl2.SelectedItem!=null)
{query=query+" and Category='"+ComboBoxControl2.Control.Text+"'";}
inventaire.Connect();
My idea is that they would type, in the ID field, something like this: "10, 24, 58, 47".
I would like then to split this text field on comas to be able to retrieve the four IDs they want.
How can I do that? With a loop maybe? I don't know how to write a split instruction, same for the loop...

Thanks for your help!