Solved

'Invalid value for field' Error

Posted on 2004-03-22
1
1,281 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

11 Experts available now in Live!

Get 1:1 Help Now