I need to create a dynamic query based on input given by the user. I have a few IF statements in my vb app, and thats how the query gets build e.g.
Code: Select all
If txtInsurer.Text "" Then
Sel = Sel & Cnd & "{Insured.InsurerId} = " & txtInsurer.Text
Cnd = " And "
End If
If TxtRepairer.Text "" Then
Sel = Sel & Cnd & "{Claim.RepairId} = " & TxtRepairer.Text
Cnd = " And "
End If
I read somewhere on the forum that I need to do something like this in my code when generating the report, but it doesn't seem to filter the information.
Report.Dictionary.Variables.Add("Insured.InsurerId", GetType(Integer))
Report.Dictionary.Variables("Insured.InsurerId").Value = txtInsurer.Text
Even if I enter a insurer id, and i have 20 insurers in my table, it still brings up everything for all insurers instead of for just the one insurer I entered in the textbox.
Any help is appreciated.