Filtering
I am evaluating Fast Reports Basic, and an using vb express 2008.
I have my own preview form setup
Report1.Preview = frmPreview.PreviewControl1
Report1.Show()
frmPreview.ShowDialog()
and I have created my own Form and report (Report1 with storeinreport set to true.)
I have a combobox on my form and various other textboxes etc. and I have a print button which uses above code.
I want my report to filter which combobox item is select and only preview that item, how can I achieve this.
My form exists in myApp as frmContacts (it is not a built in form in fastreport)
I have my own preview form setup
Report1.Preview = frmPreview.PreviewControl1
Report1.Show()
frmPreview.ShowDialog()
and I have created my own Form and report (Report1 with storeinreport set to true.)
I have a combobox on my form and various other textboxes etc. and I have a print button which uses above code.
I want my report to filter which combobox item is select and only preview that item, how can I achieve this.
My form exists in myApp as frmContacts (it is not a built in form in fastreport)
Comments
You have to pass the selected combobox value to a report parameter, before you run a report:
report1.SetParameterValue("selectedItem", the_selected_item)
and use this paramater in the databand's filter, something like this:
[MyTable.MyColumn] == [selectedItem]
One other question
How can I load a saved report through my on preview window, I have tried:
ReportSelectedPersonal.Preview = frmPreview.PreviewControl1
ReportSelectedPersonal.Load(Application.StartupPath & "\reports\Avery5321-Selected-Personal.frx")
ReportSelectedPersonal.Show()
frmPreview.ShowDialog()
But it appears blank.
If I take out the 1st and 4th line, it works, but it uses the built in preview.
I have tried to reproduce it in the demo.exe project. I've changed the code a little:
Now, when I click the "Design the report" button, the new form with the preview is opened.
Thanks for that.
I think you have misunderstood, I dont want a user to load or edit or design a report. All I want is my *.frx to appear in my preview window.
My apologies, I just thought becuase there was no reference to "Application.StartupPath & "\reports\Avery5321-Selected-Personal.frx" (myreport), then it wouldn't work, but I will try.