I have 2 parameters Country as TextBox and State as DropDown. Country parameter asks user to enter value manually and based on that Country entered the State Parameter gets populated.
But, After entering the text in Country it is required to press enter or view report button by which I am getting an error first (Please select a value for parameter State) and then the State parameter is getting populated.
Is there any way to do this without pressing enter or clicking on view report? OR Pressing enter without error prompt(Please select a value for parameter State).
You're trying to do more with SSRS parameters than they were intended for.
The cleanest solution would be to build a "searching" report that would use the MovieNamePart parameter and display a list of all of the matching movie titles.
You would then put an action on the text which would open the other report and pass the full name of the movie.
Alternatively you could just bring in all the info about the movie as well and have it displayed as a collapsed section under each name. The user would then have access to all of the information about all of the matching movies without needing to load another report.
Related
I am using the WebDataRocks reporting tool in asp.net core razor view, the user specifies some form inputs to filter the report with, and clicks show report to display the report, and when the user selects additional fields to be displayed ( from the report "fields" option in the report toolbox), and click show report again ( may he changed the filtration inputs), the newly selected fields disappear and display the fields based on the specified slice at the beginning, Is there a way to save the last selected fields (slice) by the user with the subsequent requests to display the report?
The Fields List does not save its state after some field or measure is added or removed. To change the slice, press the "Apply" button inside the Fields List.
Also, you can use the following API calls to implement a custom Fields List where all the changes are applied immediately:
getRows, getColumns, getMeasures, getReportFilters - get the
current slice configuration
getAllHierarchies, getAllMeasures - retrieve all the data about
fields
runQuery(slice) - modify the slice in runtime. Contains
rows, columns, measures, and reportFilters options from the slice
object
I have a report with a subreport. Report is unbound (it is used as a template for letter and contains plain text only). Values in the subreport are based on values of two combo boxes located in a form.
So the logic is as follows - when the form (frmForReport) is loaded the user selects values in combo boxes intended to filter the database (cboSelectCompany and cboSelectPU), then clicks OK button which opens my report with its subreport. Subreport is populated from a query where two of fields have those combo boxes as criteria. Everything works fine (I select what I need in combo boxes, report opens in Report View with the subreport showing all filtered records without any warnings or requests) until I want to switch to Print Preview or Create PDF. Every time when I do so I see pop-up window Enter Parameter Value with a reference to one of criteria used in the subreport. When I close this window I can proceed further, save it as pdf or switch to Report View but the subreport appears blank, literary disappears.
This is for Access 2010. Below is the query used as a record source for the subreport:
SELECT qryForLetter.CrossingID, qryForLetter.DispID, qryForLetter.AgreType, qryForLetter.Legal
FROM qryForLetter
WHERE (((qryForLetter.Company)=[Forms]![frmForReport]![cboSelectCompany]) AND ((qryForLetter.PU)=[Forms]![frmForReport]![cboSelectPU]));
What do I miss? How do I get rid of this pop-up window? Any help is greatly appreciated.
You could try replacing parameters [Forms]![frmForReport]![cboSelectCompany]) and [Forms]![frmForReport]![cboSelectPU] with functions.
Create global variables in the header of a module:
Public Company As ...
Public PU As ...
... replacing the ellipses ... with the correct datatype.
In your Combo Boxes' AfterUpdate events, assign the value associated with the Combo to the appropriate global variable, e.g.:
Company = cboSelectCompany
and
PU = cboSelectPU
and create functions (again replacing the ellipses ... with the correct datatype):
Public Function fnCompany() As ...
fnCompany = Company
End Function
Public Function fnPU() As ...
fnPU= PU
End Function
Then change the data source to:
SELECT qryForLetter.CrossingID, qryForLetter.DispID, qryForLetter.AgreType, qryForLetter.Legal
FROM qryForLetter
WHERE (((qryForLetter.Company)=fnCompany()) AND ((qryForLetter.PU)=fnPU()));
This has the effect of removing the dependence of the report from the form fields, which appears to be the issue.
I have a form with 3 things for my users to fill in:
a textbox called ProjectName
two ActiveX control objects (Microsoft Time and Date picker Control 6.0) called ProjStartDate and ProjEndDate respectively
After my users have entered either of the above, they can click on a button that will call requery on a list box object in the form which will display the filtered results.
I have set the Row Source Type of the listbox to be "Table/Query" and its Row Source to be the below SQL query:
SELECT p.Title
FROM Project AS p
WHERE
p.Title = [Forms]![Search by project]![ProjectName]
OR (p.StartDate <= [Forms]![Search by project]![ProjStartDate]
AND p.EndDate >= [Forms]![Search by project]![ProjEndDate])
ORDER BY
p.ProjectId DESC;
However, every time I enter the form, it will prompt me with a pop up box asking me for a parameter called Forms!Search by project!ProjectName , Forms!Search by project!ProjStartDate and Forms!Search by project!ProjEndDate . If I enter the parameter for, lets say project name correctly, the list box will display the correct filter results.
Furthermore, even if I enter the correct keyword in the ProjectName textbox and requery, the parameter pop up box will still occur. Do anyone knows how to solve this issue? Thanks a lot in advance!
I first wrote this answer based on the assumption that all the controls were contained in a single form. However, if the list box is on a child form, the parent form's controls (such as [Forms]![Search by project]![ProjectName]) are not yet available when the child form first opens. If that is the case, you could leave the list box row source property empty, and wait until the parent form's Form Load event to assign your SELECT statement to the list box row source. Or leave the list box row source empty until the user clicks the command button.
The rest of this answer was about diagnosing a naming problem. Since you indicated in a comment that the query can work when run at certain times, I don't think naming is involved after all, but will leave it in case it may help someone else.
Open the Immediate window (Ctrl+g) and investigate why the db engine can't find those parameters.
With your "Search by project" form open in Form View, check its .Name property simply to verify Access sees the name you expect. If both you and Access agree on the form's name, you will get this ...
? Forms![Search by project].Name
Search by project
OTOH, if Access thinks the form has a different name, that attempt will trigger an error. If that happens, check the form name as Access sees it. This will give you the names of all open forms:
for each f in Forms : ? f.Name : next
Finally, examine the values of those form controls. Assuming "Search by project" is indeed the correct form name ...
? Forms![Search by project]!ProjectName
? Forms![Search by project]!ProjStartDate
? Forms![Search by project]!ProjEndDate
I did the following in MS Access: I made a form which had a combo box and a button. You select an option from there and click on the button and it is supposed to open a report. Now, I wrote a query selecting a few fields from a table and in the where clause, gave the condition as where name=str(combo1.value) and the report source was specified as this query. Now, when I select the value and click on the button, it opens a blank report. How can I make it load only those particular values?
I am not saving the combo box value anywhere. It said that it would remember the value for later use. Am I doing the right thing by not saving it? What should I do to make this work? Please help me!
Edit: The combo box is using values from a column 1 in a table X. I've not bound the value to any field and am using the "Remember the value for later use" option provided. The combo box is essentially a list of hotels and the report is a list of people staying at the selected hotel. When I put the ID of the field (as defined in the X), it works. But the thing is, it should refer to the names of the hotels and not the ID, which I am supposed to enter in a popup that asks for it. What do I do?
Edit 2: The query is as follows:
SELECT Table_1.Hotel_Name, Table_2.Name_of_Delegate, Table_2.Address, Table_2.City, Table_2.Center, Table_2.Spouse_Present, Table_2.No_of_Children, Table_2.No_of_Guests, Table_2.No_of_Rooms
FROM Table_1 INNER JOIN Table_2 ON Table_1.ID=Table_2.Hotel_of_Residence
WHERE Table_1.Hotel_Name=FormName.Combo7.Text;
When I click on the button (which opens the report), it asks for the name of the hotel in a popup box. How can I avoid this? What I am doing wrong?
You can use a WhereCondition with the DoCmd.OpenReport Method as a "dynamic WHERE clause" for your report's record source. Use something like this in the click event of the command button which opens your report.
DoCmd.OpenReport "YourReport", , , "[name]=" & Me.combo1
Remove the WHERE clause you added, where name=str(combo1.value), from the report's query.
I surrounded name with square brackets because name is a reserved word. See Problem names and reserved words in Access
Edit: In a comment, you said this about the combo box:
"Row Source is SELECT [Table_Name].[ID], [Table_Name].[Name] FROM [Table_Name];. Bound Column is 1 (which I assume shows the names I wish to be displayed in the combobox.)"
When you refer to the value of a combo box, that value is the value of the "Bound Column". So in your case, the bound column is 1, which means the combo value will be [Table_Name].[ID]. However, you want to open your report based on the [Name] column of the combo. So change the bound column of the combo from 1 to 2.
To open a report using the value of your combobox, in your report query you need to do the following:
SELECT fields
FROM table
WHERE YourValue = [Form]![FormName]![ComboBox Value]
You have to specify the name of the Form, plus the value so the report query knows the value. Hope this helps.
I have two report parameters that were set up automatically when I created their associated datasets. They are ReportID and CompanyID. The user selects a Company Name from a list box and a Report Name from another list box. The standard SELECT ID, Name FROM TableName query was used to fill the respective list boxes. The report parameters work just fine and the report is displayed properly. My problem is this. I would like to place the selected Report Name and the Company Name in the report header (these are the Name values the user selected from the dropdown lists just before hitting the View Report button. I set up two new parameters, ReportName and CompanyName; marked them as hidden and set their default values to the appropriate datasets. The problem is that the header always shows the first name from the list, not the name the user selected. My question is, how do I place the selected information into the header?
I've had no problem doing this with the original set of parameters that are populated from a query.
In my reports I have a "Farm" parameter which is populated by a "SELECT FarmNumber, FarmName FROM Farms" query. The user selects the farm he wants from a ComboBox. I show the selected farm in the header of the report using this expression:
=Parameters!Farm.Label
"Label" is the "display text" (FarmName in this case) for the farm that the user selected.
Doesn't throwing in Parameters!ReportID.Value into a textbox in the header work?
From what it sounds like, you should use whatever the original Parameter is named in the 'ReportID' spot.
With SSRS 2008 R2, I had a header with multiple parameters:
My Export for [#ReportDate] [#AccountId.Label]
If CompanyID is a multi-value parameter, this will work:
=Join(Parameters!CompanyIDs.Label,System.Environment.NewLine)
=Parameters!Farm.value
replace value with Label
=Parameters!Farm.Label