473,287 Members | 1,709 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,287 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, 244 views)
File Type: jpg image002.jpg (12.8 KB, 270 views)
File Type: jpg image003.jpg (12.3 KB, 256 views)
Attached Files
File Type: zip IIFStatement.zip (75.0 KB, 96 views)
Jun 21 '10 #1
6 2106
NeoPa
32,554 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,554 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,554 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,554 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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.