I have a dataset which populates multi-choice dropdown. Lets call it "Company Chooser"
Since there are a lot of Companies I would like to add a parameter that would filter my Company Chooser.
I've added a parameter to report (with default value)
I've added Filter to my data set.
And I am getting an error
Is there something wrong with my approach or did I forget to add something that I should have ?
Second question would be - is there a way to set filter to something like "startswith"
Ps. Due to specification of project I can't filter thru query
I've searched the web and this site but have not seen an answer to my particular question. I want to produce a report based on the current record (easy), but with the primary key as the Where Condition (not so easy). I'm hoping to use the macro builder and avoid VBA, if possible.
In the macro builder, I can easily get this done by inputting "[First Name]=[Reports]![Contracts]![First Name]" in the Where Condition. 'First Name' is just a regular field present in both my main table and the report. However, customer names can change easily so I'm hoping I can use the primary key "Id", as that should be a more reliable and unchanging value. But if I try with "[Id]=[Reports]![Contracts]![Id]", I get the whole 'Enter a Parameter' dialog (and even if I input the Id value, it just outputs every record).
Why does this work with the First Name field but not the Id field? Is it because Access doesn't like to use primary keys for the Where Condition? If I use the expression builder, Access will recognize the Id field as present in my report and (therefore, I would think) as usable for this purpose. I'm assuming I'm missing something on the left of the equal sign? I've tried with Me. and Me! before and inside the brackets, but nothing. I've also tried stuff like "[Tables]![Main]![Id]=[Reports]![Contracts]![Id]" and "[Main]![Id]=[Reports]![Contracts]![Id]".
You could try creating a temporary variable and pass that to the open report action.
For example, let's say you want to open a report for a record when the user clicks on the field 'First Name' for that record in datasheet view. Your On Click embedded macro would be:
SetTempVar
Name tmpID
Expression = [Id]
OpenReport
Report Name Contracts
View Report
Filter Name
Where Condition = [Id]=[TempVars]![tmpID]
Window Mode Dialog
RemoveTempVar
Name tmpID
i have a web database and im trying to filter a datasheet, based on the contents of a tempvar. Im trying to use the record source property of the datasheet to do this.
I need to do this because, every employee that logs in should only be able to see a given subset of data in the products table. In the employee table, i have an extra column with a string value which is the data that particular employee should see.
I have a login form that on clicking login, adds this string to the tempvars collection.I can see the tempvar has been added in the immediate window as shown below:
?tempvars!tmpgrpdsc -> "IAMS"
i use the query builder option to complete the record source property as shown below.
The problem is, nothing is returned !
But when i enter the string "IAMS", i get records returned.
However, i have done this with another datasheet and it has worked, the tempvar here held a number ! See below:
What am i missing or is there a better way to filter records based on the login. Thanks
What you showed should work.
However, have you tried to change the criteria to ="""" & [Tempvars]![tmpGrdsc] & """"
Also, to make sure that your tempvar is actually containing the data during the query, you could show it as a field, just to check exactly what data is being returned during the query:
SELECT Orders.*,
[Tempvars]![tmpGrdsc] AS TmpGrdsc
FROM Orders
I am working on a complicated project in MS Access 2007.
I am having some difficulty finding the correct method/Syntax for having a query outside of the open form be requeried. I am still fairly new at the VBA so forgive me if I make mistake or I am incorrect.
I have created a query which uses the value of a particular Combo Box in my form as part of its WHERE criteria. I have tested that and it works just fine. Now I am working on an "After Update" event for the Combo Box in question so that When I change the value of that Combo Box in question it will automatically tell my query to rerun itself with the new value in the WHERE Clause.
I was originally thinking of using the following command in VBA
DoCmd.Requery [Queries]![TestQuery]
But I am unclear on if I can use the DoCmd.Requery since the query is outside of the open form and not imbedded into it.
I am looking for options on how best to accomplish this effect, Not Strictly VBA Only. So if a Macro would work better please give me an example to work from
UPDATE
Just to make things a little clearer Here is the actual SQL Code for the Select Query that I want to requery through this after Update event.
SELECT ForcastTrans.Location, ForcastTrans.Client, ForcastTrans.Department, ForcastTrans.Account, ForcastTrans.Currency, ForcastTrans.Month1, ForcastTrans.Month2, ForcastTrans.Month3, ForcastTrans.Month4, ForcastTrans.Month5, ForcastTrans.Month6, ForcastTrans.Month7, ForcastTrans.Month8, ForcastTrans.Month9, ForcastTrans.Month10, ForcastTrans.Month11, ForcastTrans.Month12
FROM ForcastTrans
WHERE (((ForcastTrans.EntityID)=[Forms]![ReportSelect]![BusinessUnit]));
As I said before this Query works just fine by itself I just need to be able to issue an after update event which will tell this query to Rerun based on the updated WHERE criteria.
Danke.
It still matters how you're building the report. I would assume that this query is the record source for the report and that the report is only generated when you request it from this very form you're updating. In which case, the query should automatically take the updated value when you load the report; If you're looking to generate the report after you close the form, then the query won't work once the combobox is destroyed. I'm still speculating on what exactly you want to do here, but suffice it to say, I don't recommend having a stored query that depends on an object in a form.
A cleaner way of doing this is to use a WhereCondition in your OpenReport call:
(inside a button click on ReportSelect)
DoCmd.OpenReport "YourReportName", acViewPreview,,"EntityID=" & Me.BusinessUnit
This opens your report filtered by the form that opens it, but still allows the report to open showing all of the data when the form is closed.
Kevin
I am building a report that I would like to accept two values from the user, feed those into a query, and find the data associated with those entries.
For example, if you had a list of employees, performance measures, and values associated with those; then the user would select an employee name / performance measure, and they would get the scoring information on that employee for that measure.
I have two parameters, each being populated from SQL queries getting a distinct list of employee names and measures, and a table below that just pulls up information based on ~ 'WHERE name = #Name AND measure = #Measure' but when I click 'Preview' to run the report locally I get the error: "one or more parameters required to run the report have not been specified"
I know the parameters are working properly because I can feed their values directly into a textbox and the values populate correctly. Also, if I change the query to just accept one parameter (i.e. WHERE measure = #Measure) the query works.
I'm confused as to why this error is occurring since I know my parameters are functioning and being populated properly.
I experienced this behavior in .NET 4.0 using Local Reports (in .rdlc files), when one of the parameter's values was containing an emtpy string. Although setting the parameter was correct:
report.SetParameters(
new List<ReportParameter> {
new ReportParameter("Title", Messages.Title),
new ReportParameter("SubTitle", Messages.Subtitle))
}
);
It worked only as long as both parameters actually contained some characters, otherwise the mentioned exception was thrown.
This error is caused when you either
A) the parameter is spelled wrong in the actual report. Meaning that the query is expecting #Name but the report is passing #Names (or some other spelling).
or
B) Is it possible you are attempting to run the report with a default value on the parameter of NULL for #Name but the stored procedure requires an actual value?
This might be happening if you are building the report in Visual Studio and gave the #Name parameter a default value of (null).
Try removing the default value or making sure you #Name parameter has an actual value, even if it's just ''.
I had similar issue. Issue happened when you use SharedDataSource with parameters that are to have null value. If you use same query in embeded data source, there is no problem.
Unlike embebed data source, you have to define if parameters used in query of shared data sources are allowed to have null value as highlighted in screenshot here. In my case, there are two parameters in query of shared data source, that can have null value.
So after setting them to allow null, problem fixed!
This caused me many hours of pain. Turns out that it's to do with using a shared dataset.
Embed the dataset within your report instead and it works fine.
For me, setting the value of the parameter makes problem. I don't know why, but the parameter value was not able to accept a string.Empty or null. So i just gave a " " as value solves the error.
Sample
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("Name", EName);
parameters[1] = new ReportParameter("ShiftName", CurrentShift);
parameters[2] = new ReportParameter("Date", LoginDate);
if(ValidateReportData())//some condition
{
parameters[3] = new ReportParameter("Date1", LoginDate);
}
else
{
//parameters[3] = new ReportParameter("Date1", string.Empty);//this makes exception while calling Render function.
parameters[3] = new ReportParameter("Date1", " ");//Solves the issue.
}
I was having the same problem, it is now sorted on sql server 2008 r2.
I know this is now an old question,
but just to help others:
It was very simple really, just making sure the spelling including the case is the same and the use of #.
I have a shared dataset called currentSpaceByDrive with the following code:
SELECT
[DRIVE]
,[Volume_Size_GB]
,[VolumeSpaceAvailable_GB]
,[VolumePercentAvailable]
FROM monitoring.dbo.currentSpaceByDrive(#ServerID)
I add the shared dataset currentSpaceByDrive to my report and I give it the same name.
when I right click on it, the one on my report, dataset properties, the parameter is #ServerID.
#ServerID value comes from another dataset, called the_servers (where the user selects a serverID)
I have a report parameter also called #ServerID that gets its value from the_servers and is used to feed the #ServerID parameter on currentSpaceByDrive.
Too many #ServerID, I understand, but if you do your own test based on this, you will get it done.
See the image attached.
hope this helps
marcelo
check DataSet In Report Server , I had Similar Problem , I was Editing Shared Dataset in Visual Studio , but it didn't work , after an hour of frustration I checked dataset in report server and I found out it Is not updating with changes I made in visual studio , I Delete it and Redeploy Dataset Again from visual studio . it works .
Actually I had to:
Delete the SubReport object from the report.
Drag new object from Toolbox
Setup the SubReport name and report
In Paramateres "Add", and choose each parameter, and related value.
Then is works for me.
I think I have same issue my Parameter Supervisor is blank when I choose "Select All" which causes the error "One or more parameters were not specified for the subreport", but if I select a few supervisor name then the sub-report appears. It is puzzling because the Manager parameter value shows all value when "Select All" is checked, but it is not working on my Supervisor parameter. Note that Supervisor parameter is dependent on manager parameter.
I'm using shared DataSets for several reports, and the root cause of this issue was not mapping the input parameters from the report itself to the parameters of the shared dataset.
To fix, I navigated to the "Report Data" panel, opened the dataset (which is really linking to a shared dataset), clicked the "Parameter" tab, and then mapped the report parameters to the parameters of the shared dataset.