473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Getting Error(#Error) in Report ... after converting Access2003 to 2007

I am getting #Error while generating report, after converting the database from 2003 to 2007.

The "#Error" when run the report. On this you have report elements use nested if-statements as parameter to the sum() function. It seems like this works on 2003, but not on 2007.

Steps;
1) Open the zip file, rename the file, by remove _ at the end of the file.

2) If you run the report based on image02, you will get
#Error in the report.

3) this is becoz of the
Expand|Select|Wrap|Line Numbers
  1. SUM Funtion : =Sum(IIf([lob1] Like "WC*",[premium1],
  2.                    IIf([lob2] Like "WC*",[premium2],
  3.                    IIf([lob3] Like "WC*",[premium3],
  4.                    IIf([lob4] Like "WC*",[premium4],
  5.                    IIf([lob5] Like "WC*",[premium5],
  6.                    IIf([lob6] Like "WC*",[premium6],
  7.                    IIf([lob1] Like "PWC*",[premium1],
  8.                    IIf([lob2] Like "PWC*",[premium2],
  9.                    IIf([lob3] Like "PWC*",[premium3],
  10.                    IIf([lob4] Like "PWC*",[premium4],
  11.                    IIf([lob5] Like "PWC*",[premium5],
  12.                    IIf([lob6] Like "PWC*",[premium6],0)))))))))))))
From my understanding... there are more arguments passed, if 8 args, then report is generating.


Is there any way by writing VB functions.. to remove this error...

Please suggest.

Thanks,
Eswar.
Attached Images
File Type: jpg image001.jpg (7.2 KB, 246 views)
File Type: jpg image002.jpg (12.8 KB, 271 views)
File Type: jpg image003.jpg (12.3 KB, 256 views)
Attached Files
File Type: zip IIFStatement.zip (75.0 KB, 98 views)
Jun 21 '10 #1
6 2110
NeoPa
32,556 Expert Mod 16PB
You may just get away with :
Expand|Select|Wrap|Line Numbers
  1. SUM Funtion : =Sum(IIf(([lob1] Like "WC*") Or ([lob1] Like "PWC*"),[premium1],
  2.                    IIf(([lob2] Like "WC*") Or ([lob2] Like "PWC*"),[premium2],
  3.                    IIf(([lob3] Like "WC*") Or ([lob3] Like "PWC*"),[premium3],
  4.                    IIf(([lob4] Like "WC*") Or ([lob4] Like "PWC*"),[premium4],
  5.                    IIf(([lob5] Like "WC*") Or ([lob5] Like "PWC*"),[premium5],
  6.                    IIf(([lob6] Like "WC*") Or ([lob6] Like "PWC*"),[premium6],0)))))))
Jun 21 '10 #2
NeoPa
32,556 Expert Mod 16PB
There are a few different options with string comparisons (See ANSI Standards in String Comparisons), but I can see none that fit your particular situation. Had it been "PWC*" or "QWC*" then we could have used "[PQ]WC*", but we cannot tell it to look for nothing in the first character - essentially moving the string along one. As you're using Like as well, as opposed to =, we can't use an In() trick either.

A function could be written, but it would need twelve (12) parameters passed, which is clumsier than I like.
Jun 21 '10 #3
@gonella123
still getting the same error even i used OR in SUM as you mentioned. Can you attach if you get any Numerical value if you use the query which you mentioned.
Jun 21 '10 #4
@gonella123
is there any way by using functions... we can do in a better way...
please include steps...
Jun 21 '10 #5
NeoPa
32,556 Expert Mod 16PB
The following function procedure should return the value related to which premium you'd like to use (1 to 6) and 7 means to use 0.
Expand|Select|Wrap|Line Numbers
  1. Public Function ChoosePremium(ByRef strLob1 As String, _
  2.                               ByRef strLob2 As String, _
  3.                               ByRef strLob3 As String, _
  4.                               ByRef strLob4 As String, _
  5.                               ByRef strLob5 As String, _
  6.                               ByRef strLob6 As String) As Integer
  7.     Dim strWork As String
  8.     Dim intPos As Integer
  9.  
  10.     strWork = Chr(0) & strLob1 & _
  11.               Chr(0) & strLob2 & _
  12.               Chr(0) & strLob3 & _
  13.               Chr(0) & strLob4 & _
  14.               Chr(0) & strLob5 & _
  15.               Chr(0) & strLob6
  16.     intPos = InStr(1, strWork, Chr(0) & "WC", vbBinaryCompare)
  17.     If intPos = 0 Then _
  18.         intPos = InStr(1, strWork, Chr(0) & "PWC", vbBinaryCompare)
  19.     Select Case intPos
  20.     Case 1
  21.         ChoosePremium = 1
  22.     Case Len(strLob1) + 2
  23.         ChoosePremium = 2
  24.     Case Len(strLob1) + _
  25.          Len(strLob2) + 3
  26.         ChoosePremium = 3
  27.     Case Len(strLob1) + _
  28.          Len(strLob2) + _
  29.          Len(strLob3) + 4
  30.         ChoosePremium = 4
  31.     Case Len(strLob1) + _
  32.          Len(strLob2) + _
  33.          Len(strLob3) + _
  34.          Len(strLob4) + 5
  35.         ChoosePremium = 5
  36.     Case > 0
  37.         ChoosePremium = 6
  38.     Case Else
  39.         ChoosePremium = 7
  40. End Function
You know how to use Choose() to convert this value to a selection from your list?
Jun 22 '10 #6
NeoPa
32,556 Expert Mod 16PB
The usage would be something like :
Expand|Select|Wrap|Line Numbers
  1. SUM Funtion : =Sum(Choose(ChoosePremium([Lob1],
  2.                                         [Lob2],
  3.                                         [Lob3],
  4.                                         [Lob4],
  5.                                         [Lob5],
  6.                                         [Lob6]),[Premium1],
  7.                                                 [Premium2],
  8.                                                 [Premium3],
  9.                                                 [Premium4],
  10.                                                 [Premium5],
  11.                                                 [Premium6],
  12.                                                 0))
Jun 22 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
1
by: timVerizon | last post by:
Hoping someone can help here.. Our application (C#.Net) was receiving IBM.Data.DB2.DB2Exceptions ERROR SQL0904N Unsuccessful execution caused by an unavailable resource. Reason code: '', type...
1
by: lorirobn | last post by:
Hello, I created an Access database in Access 2002-2003 that I am trying to convert to Access 2000. During conversion, I get error "The report name ' dirDataCopy' you entered in either the...
2
by: William Gower | last post by:
I am trying to display a page that has a data grid on it. I get this message Description: An error occurred during the processing of a configuration file required to service this request....
1
by: Harshil | last post by:
Hi All, I am working on Vb.net application with oracle as my database. I have developed reports using crystal report 9. Usually when you open reports directly in crystal report viewer control it...
3
by: Jer | last post by:
Using Access 2003 w/Windows XP. I have a database originally created with the tables internal. I split the database into a front-end/back-end with linked tables. Now when I open one of the...
2
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...
4
by: Ignacio Machin \( .NET/ C# MVP \) | last post by:
I'm getting an error "c:\inetpub\wwwroot\RGSSO\SO.aspx.cs(363): 'RGSSO.WebForm1.dataSetRG' denotes a 'field' where a 'class' was expected" on the following code: private void...
2
by: wassimdaccache | last post by:
Dear everybody, I have designed a database on office 2007. I opened a report using layout view. I am using CTRL + F option to find on the report the string that I want. Once I write the string...
7
by: CD Tom | last post by:
I'm trying to port my application to 2007 and am having a problem with the runtime. Here's what I've done and what's happening. I can open and run my .mdb with out any problem even without...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.