Solved

Compare variable's value in crystal report......

Posted on 2000-04-21
5
196 Views
Last Modified: 2010-05-02
I tried to wrote same formula in 2 different ways but unfortunately it didn't run.
It gives me below mentioned error when i try to preview my report.

1)Error: Numeric Overflow.

StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := chr({table_site.objid})
Else If {table_site.x_site_group} = "Tenant" then
    If chr({table_site.child_site2site}) = X then
        {table_site.name}
    Else
        ""
Else
    ""

2)Error:The String is non-numeric.

StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := chr({table_site.objid})
Else If {table_site.x_site_group} = "Tenant" then
    If {table_site.child_site2site} = ToNumber(X) then
        {table_site.name}
    Else
        ""
Else
    ""

Let me know as soon as you can.


Thanks for your time in advance.

Thanks,
bhavesh55
0
Comment
Question by:buddyp
  • 3
5 Comments
 

Author Comment

by:buddyp
ID: 2738342
All experts,
I am eagerly waiting for your reply.

Thanks,
buddyp
0
 

Author Comment

by:buddyp
ID: 2738421
All experts,
I am eagerly waiting for your reply.

Thanks,
buddyp
0
 

Author Comment

by:buddyp
ID: 2738476
All experts,
I am eagerly waiting for your reply.

Thanks,
buddyp
0
 
LVL 1

Accepted Solution

by:
prakashbitra earned 100 total points
ID: 2739370
hi buddyp,

 initially when u create a variable it has some garbage value in it, so we have to assign a value to that variable X.

for ur code, first if statement will work good but when it reaches to else statement u r directly comparing the database field to a garbage value..



bye
happy working
0
 
LVL 18

Expert Comment

by:mdougan
ID: 2740774
Hello,

I posted what I believe is the correct answer for you in one of the other two versions of this same question, but I'll post it here as well.  I think the problem is that you have used the chr function which is supposed to be used to convert one ascii value to one character, to try and convert a string.  To convert a number to a longer string, use the ToText function instead of the chr function.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now