Security Error with Report Viewer Control and RDLC Reports in ASP.NET 4.0 - reportviewer

Using ASP.NET 4.0, I'm creating an RDLC stream by instantiating a Microsoft.ReportingServices.RdlObjectModel.Report, setting the Code property, and returning the stream using the RdlSerializer.
Then I'm passing that stream to the ReportViewer like so:
ReportViewer1.LocalReport.LoadReportDefinition(rdlcStream);
If I don't set the Code property, I don't get any errors and the report displays properly, but when I set the Code property for a report that needs custom code, I get the below mentioned 'RequestMinimum' is obsolete error.
An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.
This error doesn't occur using the Report Viewer control in a winforms app.
Has anyone seen/resolved this issue?

I do not know exactly the cause of this error, but in my experience, it was related with a simple copy and past from a expression from one cell to other cell inside the results table, all this after making changes in the layout and groups.
I recommend you delete any expression or formula, verify that your report is executed without any error message, and rewrite down all the expressions and formulas one to one, checking in every formula that your report open correctly.
That worked for me.

For me it was the page number in this line
<Value>=Globals!PageNumber + ' of ' + Globals!TotalPages</Value>
When removed everything goes right and i don't know why

Another option for those got this error and generate report markup.
Likely one of you <Value> tags starts with "=" sign and if this is not an expression you need to use EvaluationMode="Constant".

Related

How to Call a function into rdlc report

I'm using visual studio to create a rdlc report with a function named NoToTxt that converts numbers in some fields into words
I put it in the Code area of Report Properties then I tried to call it to a textbox using an expression like this
Code.NoToTxt (Fields!Number.Value)
but it didn't work
any ideas that might help me to overcome this issue
I made a lot of research, but I didn't come with anything yet.

Microsoft Access VBA on open error

Basically I am populating my form with data from a database. For this I have an onopen event with just this code inside:
Me.Requery
Everything worked perfectly fine until yesterday, were out of the sudden an error occured. The error states:
The expression OnOpen you entered as the event property produced the following error: Instruction invalid outside of a type-block.
Aditional it says in the Discription:
The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
There may have been an error evaluating the function, event or macro.
When I go to show help it says:
This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs.
However, when I click the message away, everything loaded correctly.
I am using:
-Microsoft Access 2013
Q&A:
Does your code compile successfully?
Yes, the rest works fine. It also loads everything into the form correctly. But Every time I start it, this info filed pops up.
EDIT: I just noticed that all my on click events throw the same error now.
Could you show the whole code?
I actually have everything else commented out to troubleshoot the error. If I delete the onopen event the info box disappears.
As mentioned in the comments, compilation can fix the problem by finding errors like wrong access modifiers
When compilation goes fine, one should delete the Form_Load function and let IDE recreate it. This fixed my problem thought apparently no change in code was observed.
Many thanks
My problem was naming a label with a Farsi name. After correcting it in English, the problem was solved

On Click Error: "occurred while Microsoft Access was communicating with the OLE Server or ActiveX Control"

Seems like this is has been asked a few times before.
After working on a form for a few weeks, I suddenly get the error when I click on a button: "The expression On Click you entered as the event property produced the following error: A problem occurred while Microsoft Access was communicating with the OLE Server or Active X Control."
This also happens with any control's event on the form (e.g. After Update on other text fields)
I tried re-installing Access to no avail.
Not sure if this is relevant, but I have a subform on the form as well. I have an "on-click" event that works on the subform, but when the code breaks at the following line (which worked before):
Me.Parent.orderID = Null
The error I get is: "Method 'Parent' of object '_Form_frmOrderQuery' failed
(frmOrderQuery is the name of the subform)
Anyway, this all worked before until I changed the query for the subform by adding a few more fields.
Finally: All of the event handlers (button click, after-update, etc) work on my other forms in the database.
Any help/suggestions would be greatly appreciated.
Thanks,
jeff
Figured it out, this was stupid easy. Whatever Form is having issues, just copy it and delete the old form. Rename the new form to the same as the last (so all your vba and stuff works). Done!
I've just run into a similar problem using the Access runtime environment. It seems that the problem might be with... non-Unicode lanuage settings.
Maybe the names of the columns you added to the query contain some problematic characters?
See this article for reference: https://support.microsoft.com/en-us/kb/907337. It contains a resolution, which helped me.
All the best!
As other users mentioned the problem is in use of non-English symbols in element (form control, etc.) names.
My way to solve it:
(may be unnecessary) Create an event procedure for any element on a form.
Switch to Code Editor.
Place cursor inside any procedure.
Open drop-down list with element names (the left one above the code window).
Check if you see some names with "?????" in them.
If 5 is true, then figure out what the elements are, find them on the form and rename using only basic latin alphabet.
In my case this issue occured because of accented characters.
I was running the VBA code on a computer that uses different non-Unicode language settings than the computer on which i created the event handler, the function, or the subroutine. Note This issue may also occur if the VBA code contains accented characters or special characters. Additionally, this issue may occur if an object name in the Access database contains accented characters or special characters.
The Solution that worked for me:
"If you are running the VBA code on a Microsoft Windows XP-based computer or on a Windows 2000-based computer, you may be able to resolve this issue by changing the non-Unicode language setting on the computer where you are running the VBA code. To verify and to change the non-Unicode language setting, follow these steps.
Note Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.
Click Start,
click Run,
type Intl.cpl, and then click OK.
Under Language for non-Unicode programs on the Advanced tab, verify that the language matches the language on the computer on which you created the event handler, the function, or the subroutine. If the language differs, click the language that you want, and then click OK.
Restart the computer.
More here https://support.microsoft.com/en-us/help/907337/you-receive-an-error-message-when-you-start-visual-basic-for-applicati

Changing form name causes error message "Error accessing the system registry"

I am programming the On_Click method for the button labeled "View" in the first printscreen below. The method will load a form with data corresponding with the specific address id in the row containing the "View" button. This code worked perfectly when pointing to a target form called "Addresses". However, when I decided to rename the form "Address", I started receiving the following error message when clicking on the view button:
I did some research on the web about this error message, which lead me to try to delete any outdated references in the VBA editor. But when I clicked on Tools-->References in the VBA editor, I got the following error message:
It seems that MS Access' entries in the system registry might have been corrupted. But I am not certain of this because the documentation of this on the web is sparse and inconsistent.
Here is a link to the database on a file sharing site: http://jmp.sh/b/9Uyx6J2YzWbs8zPq2h6g
If the problem is in the database, you can recreate the problem by opening the form "Main" and clicking on the button "View" for the record shown in the printscreen above, or for other records.
Can anyone show me how to get past this error message?
my advices?
You could rename your Forms!....SourceObject to "Address" instead of "Addresses"
You could copy/paste the form, delete the original, and retry
You could install a decent debugging tool like MZ-Tools for VBA, that will help you manage your errors. Check the details here
EDIT: I used to get similar bugs years ago, when I was writing specific form event procedures. As we decided to switch to a model where forms did not need to be debbuged anymore (check this here), we stopped getting this kind of message. And I think I forgot the trick we used to solve this kind of error. If I were you:
I'd try to open another access database and import all objects ...
I'd put aside/cancel the faulty onClick procedure
And I'd install MZ Tools because otherwise VBA debugging is a nightmare ...
Since access was not liking the command button in each record of the continuous form, I choose to put the view button's logic in the on click event of a text box in each row, which I configured as enabled but locked. This produces a separate link from each record of the continuous form to a unique detail page with more of the chosen record's data.
This solution works perfectly, and is enabling me to move on with my other coding.
However, it would be nice if someone else were able to show how to get the command button solution to work.

One or more data sources is missing credentials

I am implementing a series of rdlc reports on a webpage using a ReportViewer. When the report is initially generated is works fine but when I try to change the page of the report the following error is displayed:
"One or more data sources is missing credentials"
I have checked that the Data Source of the Local report is set correctly and the fact that the first page of the report is correctly displayed is proof of this.
When I export the report to a PDF or any other format it correctly includes all the report pages.
I have also tried implementing the PageNavigation event but this error is thrown before the event is called.
Does any one have any incite into this issue and what solution there may be?
Ok I found the the problem. I had a setting AsyncRendering set to false in order enable the reportviewer to stretch to the full width of the page.
Unfortunately this causes a postback and the enitre page is reloaded and obviously the datasource is lost.
Unfortunate as I will now have to manage the width of the reportviewer manually and it does not look great.
Anyway solution is to ensure AsyncRendering = true.