I know that with this code I can change the SQL statement behind command, but I don't know where to place it.

DataEnvironment.Commands("Companies").CommandText = "SELECT Name, State FROM Companies WHERE State =' " & Text1.Text & " ' "

I have tried many procedures, for instance: DataEnvironment_Initialize(), DataReport_Initialize() etc. but any of them don't work.

I have tested my datareport and it works just fine so all the settings are right.

So if any of you know how to do this then please inform me, I would appreciated it a lot. Thanks.