Solved

'Invalid value for field' Error

Posted on 2004-03-22
1
1,308 Views
Last Modified: 2012-05-04
I have a form that access a table through a TADOQuery control which has its contents edited through a Data Grid.

It was working fine until I added a calculated field to the TADOQuery and inserted code in its OnCalcFields event like this...

with ADOQUERYTABLEX do begin

      ADOQUERYTABLEXnewfield.Value
      :=  FieldByName('FIELDY').Value * FieldByName('FIELDZ').Value ;

end;

Now whenever I try to assign any values to the table's other fields, the following exception is raised.

"Invalid value for field 'FIELDX' "

Whats going on?
0
Comment
Question by:ziche
1 Comment
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 10647883
if fieldy or fieldz is null such error may raised

replacement

      ADOQUERYTABLEXnewfield.asFloat
      :=  FieldByName('FIELDY').asFloat * FieldByName('FIELDZ').asFloat ;

meikl ;-)

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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