Solved

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

Posted on 2000-04-21
5
195 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

19 Experts available now in Live!

Get 1:1 Help Now