[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error in Formula

Posted on 2011-10-13
11
Medium Priority
?
331 Views
Last Modified: 2012-05-12

I am using attached code

Getting Run time error '20515'
Error in file
Eror in formula <Record Selection>
"{Product.Low_Stock} >= {Temp_Stock.TTL_PCS}"

This field name is not known
But both field name is correct

Highlighted on following line

CrystalReport1.Action = 1


CrystalReport1.ReportFileName = App.Path & "\Low_Stock.rpt"
    CrystalReport1.Connect = con
    CrystalReport1.DiscardSavedData = True
    CrystalReport1.RetrieveDataFiles
    CrystalReport1.SelectionFormula = "{Product.Low_Stock} >= {Temp_Stock.TTL_PCS}"
'    CrystalReport1.Formulas(1) = "FromDate = '" & DTPicker1.Value & "'"
'    CrystalReport1.Formulas(2) = "ToDate = '" & DTPicker2.Value & "'"
    CrystalReport1.Password = Chr(10) & "xxxxxxxxx"
    CrystalReport1.WindowState = crptMaximized
    CrystalReport1.Destination = crptToWindow
    CrystalReport1.Action = 1
    CrystalReport1.PageZoom 125

Open in new window

0
Comment
Question by:crystal_Tech
  • 6
  • 4
11 Comments
 
LVL 7

Expert Comment

by:Jacobfw
ID: 36961884
Make sure that your database is in sync with your table and column selections (exist and spelling)

Product.Low_Stock
Temp_Stock.TTL_PCS

and that these are included in your datasource SQL statement
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36962057
If you comment out that line does the report display?

You could also try it using each field individually to see which one it doesn't like.  Something like

CrystalReport1.SelectionFormula = "{Product.Low_Stock} >= 0"


CrystalReport1.SelectionFormula = "10 >= {Temp_Stock.TTL_PCS}"

mlmcc

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36962064
You also might edit the report and try putting that formula in the select expert.

mlmcc
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:crystal_Tech
ID: 36962203

Sir Thanks for Quick reply

i want only detail from Temp_Stock table which is less than or equal to  Low_Stock from Product Table
not using SQL statement

only using this selection formula
CrystalReport1.SelectionFormula = "{Product.Low_Stock} >= {Temp_Stock.TTL_PCS}"
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 36962212
sorry i did not read post from mlmcc
let me try
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 36962280

mlmcc :

I tried this and its giving me all record
CrystalReport1.SelectionFormula = "{Product.Low_Stock} >= 0"

but i got same error when i tried this
CrystalReport1.SelectionFormula = "10 >= {Temp_Stock.TTL_PCS}"

So what it means..?
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 total points
ID: 36962348
The first would give you all the records since the values are probably all >= 0

The second erroring means that is  the field it doesn't find

In the select expert create the formula you want.   You should be able to copy it to the code.

Also try averify database to make sure the report is showing the correct field names.

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 36962367

Oh yeh
i didnt verified my database after i add a column ( TTL_PCS ) in table Temp_Stock

Thanks mlmcc

Let me check again
and come to you.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36962491
Crystal won't know about the field until you do the verify

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 36962544

Yes you are abs right
now report is OK

it wasn't verified , after verify its working fine with accurate record.

Point is yours  :-)
0
 
LVL 1

Author Closing Comment

by:crystal_Tech
ID: 36962548
Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

872 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