|
I have searched the forum for an answer to my problem, but I can't seem to find anything related to my specific problem. I have a report that lists, among other things, a person's name. The data used for the report comes from a dataset called DataDataSet.Player_Info. I have created a report that lists the information for every player. I have set the DataSetName of the report to DataDataSet_Player_Info. That works fine. What I want to do however, is have the user select a name(s) from a listbox on another form prior to opening the report to filter the report to just show the information for that specific player(s). I have created a form called TL_Player_Filter. Here is the code that comes up with a string to filter a bindingsource I have on the form with the report:
Function constructString() As String Dim strFilterString As String = "" If ListBox1.SelectedItems.Count > 0 Then For Each SelectedName As Integer In Me.ListBox1.SelectedIndices If strFilterString.Length > 0 Then strFilterString = strFilterString & " OR " strFilterString = strFilterString & "Player='" & Me.DataDataSet.Main.Rows(SelectedName).Item("Player") & "'" Next End If Return strFilterString End Function
On the form with the report I have a bindingsource.filter to filter the data used for the report:
Me.Player_InfoBindingSource.Filter = TL_Player_Filter.constructString()
I have tried to make the bindingsource the data used for the report based on other posts to this forum, with no success. I've even tried to set a parameter or filter within the report under the Filter tab of the table in the report. Again, I either get no data passed to the report, or I get all the records in the report even though I select a specific name from the listbox. I know the constructString() works because I can use it to filter data on another form. I just can't get it to pass the data to the report.
Any help would be greatly appreciated. Please let me know if you need further detail of what I'm trying to do. Also, I'm programming in VB, not C+ and my programming knowledge is somewhat limited (self-taught).
Thanks, John - Edited byreichard2 Friday, October 09, 2009 4:43 AM
- Edited byreichard2 Friday, October 09, 2009 4:42 AM
-
|