Hi,
I have an Access2003 report based upon a query, which contains a field [Value]
In the footer I have a control : =Sum([Value])
Because the query returns sometimes no occurences, the control results in an #Error
To avoid that I modified the control into =IIf(IsError(Sum([Value]));0;Sum([Value]))
However the #Error remains
I also tried to do the IsError in a function, with the same result.
What am I missing/overlooking ?
Thanks
9 3216
Hi,
I have an Access2003 report based upon a query, which contains a field [Value]
In the footer I have a control : =Sum([Value])
Because the query returns sometimes no occurences, the control results in an #Error
To avoid that I modified the control into =IIf(IsError(Sum([Value]));0;Sum([Value]))
However the #Error remains
I also tried to do the IsError in a function, with the same result.
What am I missing/overlooking ?
Thanks
If the record source of your report returns 0 records, all controls that use those fields in an expression will return #Error. Use the No Data event of the report to cancel opening the report or change the control source of the textbox.
If the record source of your report returns 0 records, all controls that use those fields in an expression will return #Error. Use the No Data event of the report to cancel opening the report or change the control source of the textbox.
Problem is that the report (header/footer) must always be generated, even if no details are provided by the query. As such "cancel opening" is not an option.
What do you mean with "change the control source of the textbox" ? The sum is needed in case details are available.
Thanks for your help !
Yes but in case there are no details you need to set the control source to nothing so it doesn't show an error.
Yes but in case there are no details you need to set the control source to nothing so it doesn't show an error.
How can I do this dynamically ?
No way to make the IsError working ? I thought this function is there to trap the #Error status.
Thanks
How can I do this dynamically ?
No way to make the IsError working ? I thought this function is there to trap the #Error status.
Thanks
IsError doesn't work for the aggregate functions in a report. You can use the DSum() function if you want.
Or, like I mentioned earlier, use the No Data event to change the control source to an empty string.
As a side note: In your iif function, you have to use commas, not semicolons. Fixing that won't make IsError work though.
IsError doesn't work for the aggregate functions in a report. You can use the DSum() function if you want.
Or, like I mentioned earlier, use the No Data event to change the control source to an empty string.
As a side note: In your iif function, you have to use commas, not semicolons. Fixing that won't make IsError work though.
Ok, I'll give it a try tomorrow. It seems DSUM() might be what I need ! Any negative side effects (speed) ? I wonder if the query isn't re-executed for the DSUM()
Anyhow I'll have a look at NoData event too
The semicolom is related to the localisation we have.
Thank you !
Ok, I'll give it a try tomorrow. It seems DSUM() might be what I need ! Any negative side effects (speed) ? I wonder if the query isn't re-executed for the DSUM()
Anyhow I'll have a look at NoData event too
The semicolom is related to the localisation we have.
Thank you !
Yes, your query will effectively be run again for DSum. But if you don't have a whole lot of data and your database isn't on a network, the time required shouldn't be too overbearing. If it will be then you'll have to use the No Data event.
Hi,
When I try to change the Control, at runtime I get an Error 2191 (can't set property in preview or when print has started) :
Private Sub Report_NoData(Cancel As Integer)
Me.TotalTransactions.ControlSource = 0
Me.StartAmountNextMonth.ControlSource = return_rptBaseValueDC()
End Sub
Thanks
I guess no data triggers too late in the process to change the property, you'll have to do it in the On Open event. Except now you'll have to check for no data first since you can't use that event anymore.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nicola |
last post by:
Hi Everyone,
I am new to programming and would like to know how to
open an access Report from within vb 6. I am trying to write a program
to organise cross stitch threads. I have found out how...
|
by: xzzy |
last post by:
I need to automate a report in a different database (and thank yous to Terry
Kreft for pointing me in the right direction).
below is the code with the one line that does not work, marked: 'Does...
|
by: lorirobn |
last post by:
Hello,
I have a report which uses a subreport. When I run the report, I get
"Enter Parameter Value" error message for "tblGuestRoom". I click ok
and the report seems to work fine.
I...
|
by: mike_li |
last post by:
On Window 2000 Professional Server
DB2 UDB
Level:
DB2 code release "SQL07029" with level identifie
"030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and
"WR21337".
In the...
|
by: rinmanb70 |
last post by:
I have a QBF form/query and a report from the QBF that shows the
results of the QBF. I would like to show the criteria on the report
that was used in the QBF to get the info on report. I can't...
|
by: Greg |
last post by:
Most suggestions on this topic recommend to use a page footer and make
it visible only on the last page. My problem is that the footer is half
of the height of a page which means the detail would...
|
by: Intrepid_Yellow |
last post by:
Hi,
I have the following code that runs my report generator. The user
selects a table from a combo box, then whatever fields they want from a
list box. (This part all works and the report runs...
|
by: Fran |
last post by:
I recently tried to use code for "Use a multi-select list box to
filter a report" from Allen Browne in my database. I was able to add
the code and adapt it to my needs, however I am getting an...
|
by: Gord |
last post by:
When I open a certain report, it runs some code that generates the records
that will be displayed in that report. This works fine. When I go to print
preview the report it appears that the code...
|
by: smithj14 |
last post by:
I have a form to enter start and end dates then select a worker name to filter a report. This all works fine and when the report is open in preview mode it shows the date range in the txtboxes on the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |